diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-06-14 11:31:56 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-06-14 11:31:56 +0200 |
| commit | 204ba672314d9ed07ca76770a32a6af5fbd67c25 (patch) | |
| tree | f427cec965fcd27822fae3617478768d4f0f26ea /apt | |
| parent | be05af84c65c7d4bae3cbd949304b9dd7020054f (diff) | |
| parent | 3c2d0313a45668770e7cb2993dc092fb4e711bb7 (diff) | |
| download | python-apt-204ba672314d9ed07ca76770a32a6af5fbd67c25.tar.gz | |
* build against the new apt
* support for new "aptsources" pythn module
(thanks to Sebastian Heinlein)
* merged support for translated package descriptions
* merged support for automatic removal of unused dependencies
* merged http://glatzor.de/bzr/python-apt/sebi:
- this means that the new aptsources modules is available
* support translated pacakge descriptions
* support automatic dependency information
* python/depcache.cc:
- "IsGarbage()" method added (to support auto-mark)
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/cdrom.py | 1 | ||||
| -rw-r--r-- | apt/package.py | 34 |
2 files changed, 25 insertions, 10 deletions
diff --git a/apt/cdrom.py b/apt/cdrom.py index 8d73339c..9d4b62cb 100644 --- a/apt/cdrom.py +++ b/apt/cdrom.py @@ -1,4 +1,3 @@ - import apt_pkg from progress import CdromProgress diff --git a/apt/package.py b/apt/package.py index 13481be3..b82f1aa0 100644 --- a/apt/package.py +++ b/apt/package.py @@ -24,6 +24,10 @@ import sys import random import string +#from gettext import gettext as _ +import gettext +def _(s): return gettext.dgettext("python-apt", s) + class BaseDependency(object): " a single dependency " def __init__(self, name, rel, ver, pre): @@ -200,6 +204,9 @@ class Package(object): """ Return the short description (one line summary) """ if not self._lookupRecord(): return "" + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) return self._records.ShortDesc summary = property(summary) @@ -207,12 +214,17 @@ class Package(object): """ Return the formated long description """ if not self._lookupRecord(): return "" + # get the translated description + ver = self._depcache.GetCandidateVer(self._pkg) + desc_iter = ver.TranslatedDescription + self._records.Lookup(desc_iter.FileList.pop(0)) desc = "" try: - tmp = unicode(self._records.LongDesc) - except UnicodeDecodeError: - tmp = "Invalid unicode in description" - for line in string.split(tmp, "\n"): + s = unicode(self._records.LongDesc,"utf-8") + except UnicodeDecodeError,e: + s = _("Invalid unicode in description for '%s' (%s). " + "Please report.") % (self.name,e) + for line in string.split(s,"\n"): tmp = string.strip(line) if tmp == ".": desc += "\n" @@ -345,10 +357,13 @@ class Package(object): self._pcache.cachePreChange() self._depcache.MarkKeep(self._pkg) self._pcache.cachePostChange() - def markDelete(self, autoFix=True): - """ mark a package for delete. Run the resolver if autoFix is set """ + def markDelete(self, autoFix=True, purge=False): + """ mark a package for delete. Run the resolver if autoFix is set. + Mark the package as purge (remove with configuration) if 'purge' + is set. + """ self._pcache.cachePreChange() - self._depcache.MarkDelete(self._pkg) + self._depcache.MarkDelete(self._pkg, purge) # try to fix broken stuffsta if autoFix and self._depcache.BrokenCount > 0: Fix = apt_pkg.GetPkgProblemResolver(self._depcache) @@ -358,12 +373,13 @@ class Package(object): Fix.InstallProtect() Fix.Resolve() self._pcache.cachePostChange() - def markInstall(self, autoFix=True, autoInst=True): + def markInstall(self, autoFix=True, autoInst=True, fromUser=True): """ mark a package for install. Run the resolver if autoFix is set, automatically install required dependencies if autoInst is set + record it as automatically installed when fromuser is set to false """ self._pcache.cachePreChange() - self._depcache.MarkInstall(self._pkg, autoInst) + self._depcache.MarkInstall(self._pkg, autoInst, fromUser) # try to fix broken stuff if autoFix and self._depcache.BrokenCount > 0: fixer = apt_pkg.GetPkgProblemResolver(self._depcache) |
