diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2012-01-31 15:07:32 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2012-01-31 15:07:32 +0100 |
| commit | 601d841cc3644f827487a277b5e031323450a6c4 (patch) | |
| tree | be3812288ff3f77ec53de80c5e15ff8429f73578 /apt | |
| parent | 9543d9414085ba8f9b29f8b5fe6dca72d6af5fa1 (diff) | |
| parent | 64c1ffa6310efdff6353346fe621aea10e36f2c9 (diff) | |
| download | python-apt-601d841cc3644f827487a277b5e031323450a6c4.tar.gz | |
merged from lp:~mvo/python-apt/mvo
Diffstat (limited to 'apt')
| -rw-r--r-- | apt/debfile.py | 47 | ||||
| -rw-r--r-- | apt/package.py | 11 | ||||
| -rw-r--r-- | apt/progress/gtk2.py | 3 |
3 files changed, 29 insertions, 32 deletions
diff --git a/apt/debfile.py b/apt/debfile.py index 160a4a72..2eb807b8 100644 --- a/apt/debfile.py +++ b/apt/debfile.py @@ -40,9 +40,6 @@ class DebPackage(object): VERSION_SAME, VERSION_NEWER) = range(4) - _supported_data_members = ("data.tar.gz", "data.tar.bz2", "data.tar.lzma", - "data.tar.xz") - debug = 0 def __init__(self, filename=None, cache=None): @@ -82,10 +79,22 @@ class DebPackage(object): try: self._debfile.data.go(lambda item, data: files.append(item.name)) except SystemError: - return [_("List of files for '%s' could not be read" % - self.filename)] + return [_("List of files for '%s' could not be read") % + self.filename] return files + @property + def control_filelist(self): + """ return the list of files in control.tar.gt """ + control = [] + try: + self._debfile.control.go(lambda item, data: control.append(item.name)) + except SystemError: + return [_("List of control files for '%s' could not be read") % + self.filename] + return sorted(control) + + # helper that will return a pkgname with a multiarch suffix if needed def _maybe_append_multiarch_suffix(self, pkgname, in_conflict_checking=False): @@ -94,7 +103,8 @@ class DebPackage(object): return pkgname elif self._cache.is_virtual_package(pkgname): return pkgname - elif self._cache[pkgname].candidate.architecture == "all": + elif (pkgname in self._cache and + self._cache[pkgname].candidate.architecture == "all"): return pkgname # now do the real multiarch checking multiarch_pkgname = "%s:%s" % (pkgname, self._multiarch) @@ -159,10 +169,6 @@ class DebPackage(object): def _satisfy_or_group(self, or_group): """Try to satisfy the or_group.""" - - or_found = False - virtual_pkg = None - for dep in or_group: depname, ver, oper = dep @@ -232,10 +238,6 @@ class DebPackage(object): def _check_conflicts_or_group(self, or_group): """Check the or-group for conflicts with installed pkgs.""" self._dbg(2, "_check_conflicts_or_group(): %s " % (or_group)) - - or_found = False - virtual_pkg = None - for dep in or_group: depname = dep[0] ver = dep[1] @@ -513,7 +515,7 @@ class DebPackage(object): for pkg in self._need_pkgs: try: self._cache[pkg].mark_install(from_user=False) - except SystemError as e: + except SystemError: self._failure_string = _("Cannot install '%s'") % pkg self._cache.clear() return False @@ -552,19 +554,6 @@ class DebPackage(object): remove.append(pkg.name) return (install, remove, unauthenticated) - @property - def control_filelist(self): - """ return the list of files in control.tar.gt """ - try: - from debian.debfile import DebFile - except: - raise Exception(_("Python-debian module not available")) - content = [] - for name in DebFile(self.filename).control: - if name and name != ".": - content.append(name) - return sorted(content) - @staticmethod def to_hex(in_data): hex = "" @@ -606,7 +595,7 @@ class DebPackage(object): # auto-convert to hex try: data = unicode(data, "utf-8") - except Exception as e: + except Exception: new_data = _("Automatically converted to printable ascii:\n") new_data += self.to_strish(data) return new_data diff --git a/apt/package.py b/apt/package.py index 81f33a8b..73f68c87 100644 --- a/apt/package.py +++ b/apt/package.py @@ -409,6 +409,17 @@ class Version(object): return self._cand.priority_str @property + def policy_priority(self): + """Return the internal policy priority as a number. + See apt_preferences(5) for more information about what it means. + """ + priority = 0 + policy = self.package._pcache._depcache.policy + for (packagefile, _) in self._cand.file_list: + priority = max(priority, policy.get_priority(packagefile)) + return priority + + @property def record(self): """Return a Record() object for this version. diff --git a/apt/progress/gtk2.py b/apt/progress/gtk2.py index b5794e92..c2635ca0 100644 --- a/apt/progress/gtk2.py +++ b/apt/progress/gtk2.py @@ -22,9 +22,6 @@ # USA """GObject-powered progress classes and a GTK+ status widget.""" -import os -import time - import pygtk pygtk.require('2.0') import gtk |
