diff options
| author | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
|---|---|---|
| committer | Michael Vogt <egon@bottom> | 2006-07-25 13:18:15 +0200 |
| commit | d27dee5e4d80f10a8a37cf59e855484c4016e6b1 (patch) | |
| tree | ba77e5230b59ed4a0f55d3d796bd7808b5b12727 /apt | |
| parent | e491706947931c8d67b42a37c9de6f3a08098ac4 (diff) | |
| parent | 71022104cf64547ba54029555799d72e6fb8027f (diff) | |
| download | python-apt-d27dee5e4d80f10a8a37cf59e855484c4016e6b1.tar.gz | |
* merged from mainline
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/cache.py | 8 | ||||
| -rw-r--r-- | apt/package.py | 21 |
2 files changed, 19 insertions, 10 deletions
diff --git a/apt/cache.py b/apt/cache.py index 01034cf9..690510e3 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -31,10 +31,14 @@ class Cache(object): dictionary """ - def __init__(self, progress=None): + def __init__(self, progress=None, rootdir=None): self._callbacks = {} self.open(progress) + if rootdir: + apt_pkg.Config.Set("Dir", rootdir) + apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") + def _runCallbacks(self, name): """ internal helper to run a callback """ if self._callbacks.has_key(name): @@ -218,7 +222,7 @@ class Cache(object): def connect(self, name, callback): """ connect to a signal, currently only used for - cache_{post,pre}_changed """ + cache_{post,pre}_{changed,open} """ if not self._callbacks.has_key(name): self._callbacks[name] = [] self._callbacks[name].append(callback) diff --git a/apt/package.py b/apt/package.py index 4fceb904..0d1145ea 100644 --- a/apt/package.py +++ b/apt/package.py @@ -105,12 +105,12 @@ class Package(object): return ver.Downloadable def candidateDownloadable(self): " returns if the canidate is downloadable " - self._downloadable(useCandidate=True) + return self._downloadable(useCandidate=True) candidateDownloadable = property(candidateDownloadable) def installedDownloadable(self): " returns if the installed version is downloadable " - self._downloadable(useCandidate=False) + return self._downloadable(useCandidate=False) installedDownloadable = property(installedDownloadable) def sourcePackageName(self): @@ -149,13 +149,15 @@ class Package(object): def summary(self): """ Return the short description (one line summary) """ - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.ShortDesc summary = property(summary) def description(self, format=True): """ Return the formated long description """ - self._lookupRecord() + if not self._lookupRecord(): + return "" desc = "" for line in string.split(self._records.LongDesc, "\n"): tmp = string.strip(line) @@ -168,7 +170,8 @@ class Package(object): def rawDescription(self): """ return the long description (raw)""" - self._lookupRecord() + if not self._lookupRecord(): + return "" return self._records.LongDesc rawDescription = property(rawDescription) @@ -287,10 +290,12 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True): - """ mark a package for install. Run the resolver if autoFix is set """ + def markInstall(self, autoFix=True, autoInst=True): + """ mark a package for install. Run the resolver if autoFix is set, + automatically install required dependencies if autoInst is set + """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg) + self._depcache.MarkInstall(self._pkg, autoInst) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) |
