diff options
| -rw-r--r-- | aptsources/distinfo.py | 18 | ||||
| -rw-r--r-- | aptsources/distro.py | 6 | ||||
| -rw-r--r-- | aptsources/sourceslist.py | 4 | ||||
| -rw-r--r-- | debian/changelog | 7 | ||||
| -rw-r--r-- | setup.py | 4 |
5 files changed, 28 insertions, 11 deletions
diff --git a/aptsources/distinfo.py b/aptsources/distinfo.py index ddaeb218..e0ee915d 100644 --- a/aptsources/distinfo.py +++ b/aptsources/distinfo.py @@ -21,6 +21,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +from __future__ import print_function + import errno import logging import os @@ -51,7 +53,7 @@ class Template(object): def has_component(self, comp): ''' Check if the distribution provides the given component ''' - return comp in map(lambda c: c.name, self.components) + return comp in (c.name for c in self.components) def is_mirror(self, url): ''' Check if a given url of a repository is a valid mirror ''' @@ -107,7 +109,7 @@ class Mirror(object): self.repositories.append(Repository(proto, dir)) def get_repositories_for_proto(self, proto): - return filter(lambda r: r.proto == proto, self.repositories) + return [r for r in self.repositories if r.proto == proto] def has_repository(self, proto, dir): if dir is None: @@ -118,7 +120,7 @@ class Mirror(object): return False def get_repo_urls(self): - return map(lambda r: r.get_url(self.hostname), self.repositories) + return [r.get_url(self.hostname) for r in self.repositories] def get_location(self): return self.location @@ -230,11 +232,11 @@ class DistInfo(object): mirror_set = {} try: with open(value) as value_f: - mirror_data = filter(match_mirror_line.match, - [x.strip() for x in - value_f]) + mirror_data = list(filter( + match_mirror_line.match, + [x.strip() for x in value_f])) except Exception: - print "WARNING: Failed to read mirror file" + print("WARNING: Failed to read mirror file") mirror_data = [] for line in mirror_data: if line.startswith("#LOC:"): @@ -298,7 +300,7 @@ if __name__ == "__main__": logging.info("BaseURI: %s" % template.base_uri) logging.info("MatchURI: %s" % template.match_uri) if template.mirror_set != {}: - logging.info("Mirrors: %s" % template.mirror_set.keys()) + logging.info("Mirrors: %s" % list(template.mirror_set.keys())) for comp in template.components: logging.info(" %s -%s -%s" % (comp.name, comp.description, diff --git a/aptsources/distro.py b/aptsources/distro.py index 27d7f859..ca87a919 100644 --- a/aptsources/distro.py +++ b/aptsources/distro.py @@ -327,12 +327,14 @@ class Distribution(object): if s.type == self.binary_type: if s.dist not in comps_per_dist: comps_per_dist[s.dist] = set() - map(comps_per_dist[s.dist].add, s.comps) + for c in s.comps: + comps_per_dist[s.dist].add(c) for s in self.source_code_sources: if s.type == self.source_type: if s.dist not in comps_per_sdist: comps_per_sdist[s.dist] = set() - map(comps_per_sdist[s.dist].add, s.comps) + for c in s.comps: + comps_per_sdist[s.dist].add(c) # check if there is a main source at all if len(self.main_sources) < 1: diff --git a/aptsources/sourceslist.py b/aptsources/sourceslist.py index 03377258..61b75f75 100644 --- a/aptsources/sourceslist.py +++ b/aptsources/sourceslist.py @@ -23,6 +23,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 # USA +from __future__ import absolute_import + import glob import logging import os.path @@ -31,7 +33,7 @@ import shutil import time import apt_pkg -from distinfo import DistInfo +from .distinfo import DistInfo from apt.deprecation import function_deprecated_by #from apt_pkg import gettext as _ diff --git a/debian/changelog b/debian/changelog index 1466ad7b..fe560625 100644 --- a/debian/changelog +++ b/debian/changelog @@ -56,8 +56,15 @@ python-apt (0.8.4~exp1) experimental; urgency=low python-apt (0.8.3ubuntu9) UNRELEASED; urgency=low + [ Steve Langasek ] * Don't leak file descriptors. + [ Colin Watson ] + * aptsources/*.py, setup.py: Make aptsources modules work directly in + either Python 2 or 3, and exclude the "future" 2to3 fixer so that 2to3 + doesn't need to modify them. This makes life a little easier for the + strange tricks update-manager plays with its dist-upgrader tarball. + -- Evan Dandrea <ev@ubuntu.com> Mon, 11 Jun 2012 17:00:37 +0100 python-apt (0.8.3) unstable; urgency=low @@ -25,7 +25,11 @@ except ImportError: if sys.version_info[0] == 3: from distutils.command.build_py import build_py_2to3 + from lib2to3.refactor import get_fixers_from_package cmdclass['build_py'] = build_py_2to3 + cmdclass['build_py'].fixer_names = sorted( + set(get_fixers_from_package("lib2to3.fixes")) - + set(["lib2to3.fixes.fix_future"])) # The apt_pkg module. files = ['apt_pkgmodule.cc', 'acquire.cc', 'cache.cc', 'cdrom.cc', |
