diff -Nru germinate-2.31/debian/changelog germinate-2.32/debian/changelog --- germinate-2.31/debian/changelog 2019-02-27 13:05:05.000000000 +0000 +++ germinate-2.32/debian/changelog 2019-08-07 10:43:16.000000000 +0000 @@ -1,3 +1,22 @@ +germinate (2.32) unstable; urgency=medium + + * Remove ancient X-Python-Version and X-Python3-Version fields. + * Upgrade to debhelper v9. + * Install debhelper extension using debhelper rather than from setup.py. + * Convert to pybuild. + * Apply "wrap-and-sort -at". + * Simplify the approach for injecting the package version. + * Add tox testing support. + * Drop support for Python 3.2 (which lacked u"..." literals). + * Use six instead of hand-written Python 2/3 portability code. + * Use testtools rather than plain unittest/unittest2. + * Silence noisy logging from test suite. + * Switch from pychecker to flake8. + * Drop Python 2 binary package (but still supported upstream). + * Policy version 4.4.0: no changes required. + + -- Colin Watson Wed, 07 Aug 2019 11:43:16 +0100 + germinate (2.31) unstable; urgency=medium * Set Homepage to https://launchpad.net/germinate (closes: #923388). diff -Nru germinate-2.31/debian/clean germinate-2.32/debian/clean --- germinate-2.31/debian/clean 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/debian/clean 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,2 @@ +debhelper/dh_germinate_clean.1 +debhelper/dh_germinate_metapackage.1 diff -Nru germinate-2.31/debian/compat germinate-2.32/debian/compat --- germinate-2.31/debian/compat 2015-05-18 02:25:13.000000000 +0000 +++ germinate-2.32/debian/compat 2019-08-07 10:43:16.000000000 +0000 @@ -1 +1 @@ -7 +9 diff -Nru germinate-2.31/debian/control germinate-2.32/debian/control --- germinate-2.31/debian/control 2019-02-27 13:02:40.000000000 +0000 +++ germinate-2.32/debian/control 2019-08-07 10:43:16.000000000 +0000 @@ -2,42 +2,42 @@ Section: utils Priority: optional Maintainer: Colin Watson -Standards-Version: 3.9.6 -Build-Depends: debhelper (>= 7.0.50~), dh-python -Build-Depends-Indep: python (>= 2.7), python-all, python3 (>= 3.1.2-8~), python3-all, python-setuptools, python3-setuptools, python-apt (>= 0.7.93.2~), python3-apt (>= 0.7.93.2~), python-unittest2 +Standards-Version: 4.4.0 +Build-Depends: debhelper (>= 9~), + dh-exec, + dh-python, +Build-Depends-Indep: python3 (>= 3.1.2-8~), + python3-all, + python3-apt (>= 0.7.93.2~), + python3-fixtures, + python3-flake8, + python3-setuptools, + python3-six, + python3-testtools, Homepage: https://launchpad.net/germinate Vcs-Git: https://git.launchpad.net/germinate Vcs-Browser: https://git.launchpad.net/germinate -X-Python-Version: >= 2.7 -X-Python3-Version: >= 3.2 Rules-Requires-Root: no Package: germinate Architecture: all -Depends: ${misc:Depends}, ${python3:Depends}, ${perl:Depends}, python3-germinate (= ${binary:Version}) +Depends: python3-germinate (= ${binary:Version}), + ${misc:Depends}, + ${perl:Depends}, + ${python3:Depends}, Description: expand dependencies in a list of seed packages Germinate takes lists of seed packages and expands their dependencies to produce a full list of packages. This can be used for purposes such as managing the list of packages present in a derived distribution's archive or CD builds. -Package: python-germinate -Section: python -Architecture: all -Depends: ${misc:Depends}, ${python:Depends}, python-apt (>= 0.7.93.2~) -Description: expand dependencies in seed packages (Python 2 interface) - Germinate takes lists of seed packages and expands their dependencies to - produce a full list of packages. This can be used for purposes such as - managing the list of packages present in a derived distribution's archive - or CD builds. - . - This package provides Python 2 modules used by Germinate, which may also be - used directly. - Package: python3-germinate Section: python Architecture: all -Depends: ${misc:Depends}, ${python3:Depends}, python3-apt (>= 0.7.93.2~) +Depends: python3-apt (>= 0.7.93.2~), + python3-pkg-resources, + ${misc:Depends}, + ${python3:Depends}, Description: expand dependencies in seed packages (Python 3 interface) Germinate takes lists of seed packages and expands their dependencies to produce a full list of packages. This can be used for purposes such as diff -Nru germinate-2.31/debian/germinate.install germinate-2.32/debian/germinate.install --- germinate-2.31/debian/germinate.install 2015-05-18 02:34:15.000000000 +0000 +++ germinate-2.32/debian/germinate.install 2019-08-07 10:43:16.000000000 +0000 @@ -1,3 +1,5 @@ -usr/bin -usr/share/man -usr/share/perl5 +#! /usr/bin/dh-exec + +debhelper/dh_germinate_clean usr/bin +debhelper/dh_germinate_metapackage usr/bin +debhelper/germinate.pm ${PERL_VENDORLIB}/Debian/Debhelper/Sequence diff -Nru germinate-2.31/debian/germinate.manpages germinate-2.32/debian/germinate.manpages --- germinate-2.31/debian/germinate.manpages 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/debian/germinate.manpages 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,2 @@ +debhelper/dh_germinate_clean.1 +debhelper/dh_germinate_metapackage.1 diff -Nru germinate-2.31/debian/python3-germinate.install germinate-2.32/debian/python3-germinate.install --- germinate-2.31/debian/python3-germinate.install 2015-05-18 02:34:15.000000000 +0000 +++ germinate-2.32/debian/python3-germinate.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/python3 diff -Nru germinate-2.31/debian/python-germinate.install germinate-2.32/debian/python-germinate.install --- germinate-2.31/debian/python-germinate.install 2015-05-18 02:34:15.000000000 +0000 +++ germinate-2.32/debian/python-germinate.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -usr/lib/python2.* diff -Nru germinate-2.31/debian/rules germinate-2.32/debian/rules --- germinate-2.31/debian/rules 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/debian/rules 2019-08-07 10:43:16.000000000 +0000 @@ -1,46 +1,25 @@ #! /usr/bin/make -f -%: - dh $@ --with python2,python3 + +include /usr/share/dpkg/pkg-info.mk export LC_ALL := C.UTF-8 +export PERL_VENDORLIB := $(shell perl -MConfig -e 'print $$Config{vendorlib}') +export PYBUILD_NAME := germinate +export PYBUILD_INSTALL_ARGS_python3 := \ + --install-scripts=../germinate/usr/bin \ + --install-data=../germinate/usr -PY2REQUESTED := $(shell pyversions -r) -PY2DEFAULT := $(shell pyversions -d) -PY3REQUESTED := $(shell py3versions -r) -PY3DEFAULT := $(shell py3versions -d) -# Run setup.py with the default python/python3 last so that the scripts use -# #!/usr/bin/python(3) and not #!/usr/bin/pythonX.Y. -PY2 := $(filter-out $(PY2DEFAULT),$(PY2REQUESTED)) python -PY3 := $(filter-out $(PY3DEFAULT),$(PY3REQUESTED)) python3 +%: + dh $@ --with python3 --buildsystem=pybuild override_dh_auto_build: + echo '$(DEB_VERSION)' >germinate/version.txt dh_auto_build - set -e; for python in $(PY3); do \ - $$python setup.py build; \ - done - -ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) -override_dh_auto_test: - set -e; for python in $(PY2) $(PY3); do \ - $$python setup.py test; \ + set -e; for script in dh_germinate_clean dh_germinate_metapackage; do \ + pod2man -c Debhelper -r $(DEB_VERSION) \ + debhelper/$$script debhelper/$$script.1; \ done -endif override_dh_auto_clean: + echo '$(DEB_VERSION)' >germinate/version.txt dh_auto_clean - rm -rf build - -override_dh_auto_install: - # setuptools likes to leave some debris around, which confuses things. - find build -name \*.pyc -print0 | xargs -0r rm -f - find build -name __pycache__ -print0 | xargs -0r rm -rf - find build -name \*.egg-info -print0 | xargs -0r rm -rf - dh_auto_install - # Allow the Python 3 top-level scripts to take priority. - set -e; for python in $(PY3); do \ - $$python setup.py install --force --root=$(CURDIR)/debian/tmp \ - --no-compile -O0 --install-layout=deb; \ - done - -override_dh_python2: - dh_python2 -ppython-germinate diff -Nru germinate-2.31/debian/source/options germinate-2.32/debian/source/options --- germinate-2.31/debian/source/options 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/debian/source/options 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1 @@ +tar-ignore = .tox diff -Nru germinate-2.31/germinate/archive.py germinate-2.32/germinate/archive.py --- germinate-2.31/germinate/archive.py 2019-02-06 10:25:09.000000000 +0000 +++ germinate-2.32/germinate/archive.py 2019-08-07 10:43:16.000000000 +0000 @@ -31,17 +31,11 @@ import subprocess import sys import tempfile -try: - from urllib.parse import quote - from urllib.request import Request, urlopen -except ImportError: - from urllib import quote - from urllib2 import Request, urlopen import apt_pkg - - -__pychecker__ = 'no-reuseattr' +import six +from six.moves.urllib.parse import quote +from six.moves.urllib.request import Request, urlopen _logger = logging.getLogger(__name__) @@ -51,11 +45,6 @@ _logger.info(msg, *args, extra={'progress': True}, **kwargs) -if sys.version >= '3': - _string_types = str -else: - _string_types = basestring - if sys.version >= '3.1': def get_request_type(req): return req.type @@ -99,13 +88,13 @@ def __init__(self, dists, components, arch, mirrors, source_mirrors=None, installer_packages=True, cleanup=False): """Create a representation of a Debian-format apt archive.""" - if isinstance(dists, _string_types): + if isinstance(dists, six.string_types): dists = [dists] - if isinstance(components, _string_types): + if isinstance(components, six.string_types): components = [components] - if isinstance(mirrors, _string_types): + if isinstance(mirrors, six.string_types): mirrors = [mirrors] - if isinstance(source_mirrors, _string_types): + if isinstance(source_mirrors, six.string_types): source_mirrors = [source_mirrors] self._dists = dists @@ -183,10 +172,10 @@ else: raise RuntimeError("Unknown suffix '%s'" % suffix) - with decompressor(compressed) as compressed_f, \ - open(fullname, "wb") as f: - f.write(compressed_f.read()) - f.flush() + with decompressor(compressed) as compressed_f: + with open(fullname, "wb") as f: + f.write(compressed_f.read()) + f.flush() finally: if suffix: try: diff -Nru germinate-2.31/germinate/germinator.py germinate-2.32/germinate/germinator.py --- germinate-2.31/germinate/germinator.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/germinator.py 2019-08-07 10:43:16.000000000 +0000 @@ -303,9 +303,9 @@ left_lesser = self._germinator._strictly_outer_seeds(self) right_lesser = other._germinator._strictly_outer_seeds(other) left_close = [l for l in left_lesser - if self.name in l._close_seeds] + if self.name in l._close_seeds] right_close = [l for l in right_lesser - if other.name in l._close_seeds] + if other.name in l._close_seeds] if left_close != right_close: return False left_branch = self.structure.branch @@ -753,7 +753,7 @@ for innerseed in self._inner_seeds(seed): if (pkg in innerseed._entries or - pkg in innerseed._recommends_entries): + pkg in innerseed._recommends_entries): return True return False @@ -813,7 +813,7 @@ elif name.endswith("-include"): included_seed = name[:-8] if (included_seed not in structure.names and - included_seed != "extra"): + included_seed != "extra"): _logger.error("Cannot include packages from unknown " "seed: %s", included_seed) else: @@ -823,7 +823,7 @@ elif name.endswith("-exclude"): excluded_seed = name[:-8] if (excluded_seed not in structure.names and - excluded_seed != "extra"): + excluded_seed != "extra"): _logger.error("Cannot exclude packages from unknown " "seed: %s", excluded_seed) else: @@ -872,7 +872,9 @@ if pkg.startswith('(') and pkg.endswith(')'): pkg = pkg[1:-1] if is_snap or pkg.startswith("snap:"): - _logger.warning("Recommends entries cannot be used with snap packages, ignoring %s", pkg) + _logger.warning( + "Recommends entries cannot be used with snap " + "packages, ignoring %s", pkg) continue pkgs = self._filter_packages(self._packages, pkg) if not pkgs: @@ -882,14 +884,16 @@ substvars, pkg)) if is_snap and pkg.startswith('%'): - _logger.warning("%% entries cannot be used with snap packages, ignoring %s", pkg) + _logger.warning( + "%% entries cannot be used with snap packages, ignoring " + "%s", pkg) continue if pkg.startswith('%'): pkg = pkg[1:] if pkg in self._sources: pkgs = [p for p in self._sources[pkg]["Binaries"] - if p in self._packages] + if p in self._packages] else: _logger.warning("Unknown source package: %s", pkg) pkgs = [] @@ -908,10 +912,12 @@ else: if is_snap: for pkg in pkgs: - seedsnaps.extend(self._substitute_seed_vars(substvars, pkg)) + seedsnaps.extend( + self._substitute_seed_vars(substvars, pkg)) else: for pkg in pkgs: - seedpkgs.extend(self._substitute_seed_vars(substvars, pkg)) + seedpkgs.extend( + self._substitute_seed_vars(substvars, pkg)) di_kernel_versions = None @@ -960,7 +966,7 @@ for pkg in self._hints: if (self._hints[pkg] == seed.name and - not self._already_seeded(seed, pkg)): + not self._already_seeded(seed, pkg)): if pkg in self._packages: if pkg in seedrecommends: seed._recommends_entries.append(pkg) @@ -1062,8 +1068,11 @@ self._add_package(seed, pkg, seed._seed_reason) for pkg in self.get_seed_snap_entries(structure, seedname): # avoid collisions with deb packages with the same name - self._remember_why(seed._snap_reasons, pkg, seed._seed_reason, False, False) - self._remember_why(output._all_snap_reasons, pkg, seed._seed_reason, False, False) + self._remember_why( + seed._snap_reasons, pkg, seed._seed_reason, False, False) + self._remember_why( + output._all_snap_reasons, pkg, seed._seed_reason, + False, False) self._di_kernel_versions = None @@ -1140,7 +1149,7 @@ "%s", depend) return False if (seed is not None and - self._is_pruned(self._di_kernel_versions, depname)): + self._is_pruned(self._di_kernel_versions, depname)): return False depmultiarch = self._packages[depname]["Multi-Arch"] if depqual == "any" and depmultiarch != "allowed": @@ -1149,7 +1158,7 @@ if depqual not in (None, "any", "native"): return False if (depqual == "native" and - depmultiarch not in ("none", "same", "allowed")): + depmultiarch not in ("none", "same", "allowed")): return False return self._packagetype[depname] == "deb" else: @@ -1161,7 +1170,7 @@ pkgkernver = self._packages[pkg]["Kernel-Version"] depkernver = self._packages[depname]["Kernel-Version"] if (pkgkernver != "" and depkernver != "" and - pkgkernver != depkernver): + pkgkernver != depkernver): return False return True else: @@ -1256,7 +1265,7 @@ for pkg in output._all: fields = ["Pre-Depends", "Depends"] if (self._follow_recommends(structure) or - self._packages[pkg]["Section"] == "metapackages"): + self._packages[pkg]["Section"] == "metapackages"): fields.append("Recommends") for field in fields: for deplist in self._packages[pkg][field]: @@ -1284,7 +1293,7 @@ fields = ["Pre-Depends", "Depends"] if (self._follow_recommends(structure) or - self._packages[pkg]["Section"] == "metapackages"): + self._packages[pkg]["Section"] == "metapackages"): fields.append("Recommends") fields.extend(BUILD_DEPENDS) for field in fields: @@ -1313,7 +1322,7 @@ if trydep in innerseed._not_build: return True if (trydep in seed._entries or - trydep in seed._recommends_entries): + trydep in seed._recommends_entries): return True else: return False @@ -1367,11 +1376,11 @@ lesserseeds = self._strictly_outer_seeds(seed) if close: lesserseeds = [l for l in lesserseeds - if seed.name in l._close_seeds] + if seed.name in l._close_seeds] for trydep in trylist: for lesserseed in lesserseeds: if (trydep in lesserseed._entries or - trydep in lesserseed._recommends_entries): + trydep in lesserseed._recommends_entries): # Has it already been promoted from this seed? already_promoted = False for innerseed in self._inner_seeds(lesserseed): @@ -1436,10 +1445,10 @@ # dependency is, then pick all the modules for other allowed # kernel versions too. if (self._packages[pkg]["Kernel-Version"] == "" and - self._packages[dependlist[0]]["Kernel-Version"] != ""): + self._packages[dependlist[0]]["Kernel-Version"] != ""): dependlist = [d for d in dependlist - if not self._di_kernel_versions or - (self._packages[d]["Kernel-Version"] in + if not self._di_kernel_versions or ( + self._packages[d]["Kernel-Version"] in self._di_kernel_versions)] else: dependlist = [dependlist[0]] @@ -1472,7 +1481,7 @@ # will be a bit inaccurate. We may need another pass for # Recommends to fix this. if self._already_satisfied( - seed, pkg, dep, build_depend, second_class): + seed, pkg, dep, build_depend, second_class): break else: firstdep = True @@ -1583,7 +1592,7 @@ build_tree=build_tree) if (self._follow_recommends(seed.structure, seed) or - self._packages[pkg]["Section"] == "metapackages"): + self._packages[pkg]["Section"] == "metapackages"): self._add_dependency_tree(seed, pkg, self._packages[pkg]["Recommends"], second_class=second_class, @@ -1616,7 +1625,8 @@ else: pkg_srcs.append(pkg_src) else: - _logger.error("Missing source package: %s (for %s)", pkg_src, pkg) + _logger.error( + "Missing source package: %s (for %s)", pkg_src, pkg) # Use build_tree flag for src # Treat all Built-Using as if it's part of build_tree @@ -1634,10 +1644,9 @@ if self._follow_build_depends(seed.structure, seed): for build_depends in BUILD_DEPENDS: - self._add_dependency_tree(seed, pkg, - self._sources[pkg_src][build_depends], - build_depend=True) - + self._add_dependency_tree( + seed, pkg, self._sources[pkg_src][build_depends], + build_depend=True) def _rescue_includes(self, structure, seedname, rescue_seedname, build_tree): @@ -1650,7 +1659,7 @@ return if (rescue_seedname not in structure.names and - rescue_seedname != "extra"): + rescue_seedname != "extra"): return # Find all the source packages. @@ -1669,7 +1678,7 @@ # patterns. for src in rescue_srcs: rescue = [p for p in self._sources[src]["Binaries"] - if p in self._packages] + if p in self._packages] included = set() if rescue_seedname in seed._includes: for include in seed._includes[rescue_seedname]: @@ -1726,17 +1735,13 @@ continue output -= innerseed._depends # Take care to preserve the original ordering. - # Use a temporary variable to work around a pychecker bug. - ret = [e for e in seed._entries if e in output] - return ret + return [e for e in seed._entries if e in output] def get_seed_entries(self, structure, seedname): """Return the explicitly seeded entries for this seed.""" - # Use a temporary variable to work around a pychecker bug. - ret = [ + return [ e for e in self._get_seed_entries(structure, seedname) if not isinstance(e, SeedKernelVersions)] - return ret def _get_seed_recommends_entries(self, structure, seedname): """Return the explicitly seeded Recommends entries for this seed. @@ -1751,17 +1756,13 @@ continue output -= innerseed._depends # Take care to preserve the original ordering. - # Use a temporary variable to work around a pychecker bug. - ret = [e for e in seed._recommends_entries if e in output] - return ret + return [e for e in seed._recommends_entries if e in output] def get_seed_recommends_entries(self, structure, seedname): """Return the explicitly seeded Recommends entries for this seed.""" - # Use a temporary variable to work around a pychecker bug. - ret = [ + return [ e for e in self._get_seed_recommends_entries(structure, seedname) if not isinstance(e, SeedKernelVersions)] - return ret def get_seed_snap_entries(self, structure, seedname): """Return the explicitly seeded snap entries for this seed.""" @@ -1772,9 +1773,7 @@ continue output -= innerseed._depends # Take care to preserve the original ordering. - # Use a temporary variable to work around a pychecker bug. - ret = [e for e in seed._snaps if e in output] - return ret + return [e for e in seed._snaps if e in output] def get_snaps(self, structure, seedname): """ Return the explicitly seeded snap entries for this seed.""" @@ -1980,8 +1979,8 @@ for seedname in structure.names: all_snaps |= self.get_snaps(structure, seedname) - self._write_snap_list(self._output[structure]._all_snap_reasons, filename, - all_snaps) + self._write_snap_list(self._output[structure]._all_snap_reasons, + filename, all_snaps) def write_all_source_list(self, structure, filename): """Write all the source packages for this structure.""" diff -Nru germinate-2.31/germinate/log.py germinate-2.32/germinate/log.py --- germinate-2.31/germinate/log.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/log.py 2019-08-07 10:43:16.000000000 +0000 @@ -49,9 +49,9 @@ def germinate_logging(level): """Configure logging as preferred by Germinate command-line tools.""" - logging.basicConfig() logger = logging.getLogger('germinate') if not logger.handlers: + logging.basicConfig() logger.setLevel(level) handler = logging.StreamHandler(sys.stdout) handler.setFormatter(GerminateFormatter()) diff -Nru germinate-2.31/germinate/scripts/germinate_main.py germinate-2.32/germinate/scripts/germinate_main.py --- germinate-2.31/germinate/scripts/germinate_main.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/scripts/germinate_main.py 2019-08-07 10:43:16.000000000 +0000 @@ -187,7 +187,7 @@ g.write_depends_list(structure, seedname + ".depends", seedname) g.write_build_depends_list(structure, seedname + ".build-depends", seedname) - g.write_snap_list (structure, seedname + ".snaps", seedname) + g.write_snap_list(structure, seedname + ".snaps", seedname) if seedname != "extra" and seedname in structure: structure.write_seed_text(seedname + ".seedtext", seedname) diff -Nru germinate-2.31/germinate/scripts/germinate_pkg_diff.py germinate-2.32/germinate/scripts/germinate_pkg_diff.py --- germinate-2.31/germinate/scripts/germinate_pkg_diff.py 2018-06-22 10:55:19.000000000 +0000 +++ germinate-2.32/germinate/scripts/germinate_pkg_diff.py 2019-08-07 10:43:16.000000000 +0000 @@ -149,8 +149,8 @@ else: with open(fname) as f: lines = f.readlines() - for l in lines: - pkg, st = l.split(None) + for line in lines: + pkg, st = line.split(None) self.package.setdefault(pkg, Package(pkg)) if st == "install" or st == "hold": self.package[pkg].set_installed() @@ -160,9 +160,9 @@ def output(self): for k in sorted(self.package): - l = self.package[k].output(self.outmode) - if len(l): - print(l) + line = self.package[k].output(self.outmode) + if len(line): + print(line) def parse_options(argv): diff -Nru germinate-2.31/germinate/scripts/germinate_update_metapackage.py germinate-2.32/germinate/scripts/germinate_update_metapackage.py --- germinate-2.31/germinate/scripts/germinate_update_metapackage.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/scripts/germinate_update_metapackage.py 2019-08-07 10:43:16.000000000 +0000 @@ -46,9 +46,6 @@ import germinate.version -__pychecker__ = 'maxlocals=80' - - def error_exit(message): print("%s: %s" % (sys.argv[0], message), file=sys.stderr) sys.exit(1) @@ -165,7 +162,7 @@ mapped_seeds = config.get(dist, "seed_map/%s" % seed_name).split() else: mapped_seeds = [] - task_seeds_re = re.compile('^Task-Seeds:\s*(.*)', re.I) + task_seeds_re = re.compile(r'^Task-Seeds:\s*(.*)', re.I) with structure[seed_name] as seed: for line in seed: task_seeds_match = task_seeds_re.match(line) @@ -183,7 +180,7 @@ if config.has_option(dist, "metapackage_map/%s" % seed_name): return config.get(dist, "metapackage_map/%s" % seed_name) else: - task_meta_re = re.compile('^Task-Metapackage:\s*(.*)', re.I) + task_meta_re = re.compile(r'^Task-Metapackage:\s*(.*)', re.I) with structure[seed_name] as seed: for line in seed: task_meta_match = task_meta_re.match(line) @@ -371,7 +368,6 @@ mergeditems = sorted(merged.items()) for package, value in mergeditems: - #print(package, value) if value == 1: if recommends_merged.get(package, 0) == -1: moves[package].append([seed_name, architecture]) @@ -388,7 +384,6 @@ mergedrecitems = sorted(recommends_merged.items()) for package, value in mergedrecitems: - #print(package, value) if value == 1: additions[package].append([seed_name_recommends, architecture]) diff -Nru germinate-2.31/germinate/seeds.py germinate-2.32/germinate/seeds.py --- germinate-2.31/germinate/seeds.py 2019-02-06 10:25:09.000000000 +0000 +++ germinate-2.32/germinate/seeds.py 2019-08-07 10:43:16.000000000 +0000 @@ -31,21 +31,16 @@ import subprocess import sys import tempfile -try: - from urllib.parse import urljoin, urlparse as _urlparse - from urllib.request import Request, URLError, urlopen -except ImportError: - from urlparse import urljoin, urlparse as _urlparse - from urllib2 import Request, URLError, urlopen + +import six +from six.moves.urllib.error import URLError +from six.moves.urllib.parse import urljoin, urlparse +from six.moves.urllib.request import Request, urlopen import germinate.defaults from germinate.tsort import topo_sort -# pychecker gets confused by __next__ for Python 3 support. -__pychecker__ = 'no-special' - - __all__ = [ 'Seed', 'SeedError', @@ -60,14 +55,6 @@ _vcs_cache_dir = None -if sys.version >= '3': - _string_types = str - _text_type = str -else: - _string_types = basestring - _text_type = unicode - - class AtomicFile(object): """Facilitate atomic writing of files. Forces UTF-8 encoding.""" @@ -91,10 +78,6 @@ if exc_type is None: os.rename('%s.new' % self.filename, self.filename) - # Not really necessary, but reduces pychecker confusion. - def write(self, s): - self.fd.write(s) - class SeedError(RuntimeError): """An error opening or parsing a seed.""" @@ -103,10 +86,10 @@ def _ensure_unicode(s): - if isinstance(s, _text_type): + if isinstance(s, six.text_type): return s else: - return _text_type(s, "utf8", "replace") + return six.text_type(s, "utf8", "replace") class SeedVcs(object): @@ -122,7 +105,7 @@ GIT = 3 -class Seed(object): +class Seed(six.Iterator): """A single seed from a collection.""" def _open_seed_bzr(self, base, branch, name): @@ -190,7 +173,7 @@ if not path.endswith('/'): path += '/' url = urljoin(path, name) - if not _urlparse(url).scheme: + if not urlparse(url).scheme: fullpath = os.path.join(path, name) _logger.info("Using %s", fullpath) return open(fullpath) @@ -223,7 +206,7 @@ def __init__(self, bases, branches, name, vcs=None): """Read a seed from a collection.""" - if isinstance(branches, _string_types): + if isinstance(branches, six.string_types): branches = [branches] self._name = name @@ -308,9 +291,6 @@ """Read the next line from this seed.""" return next(self._file) - if sys.version < '3': - next = __next__ - def close(self): """Close the file object for this seed.""" self._file.close() @@ -503,7 +483,7 @@ child_structure_name = child_structure_line.split()[0][:-1] for i in range(len(all_structure)): if (all_structure[i].split()[0][:-1] == - child_structure_name): + child_structure_name): del all_structure[i] break all_structure.append(child_structure_line) diff -Nru germinate-2.31/germinate/tests/helpers.py germinate-2.32/germinate/tests/helpers.py --- germinate-2.31/germinate/tests/helpers.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/tests/helpers.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,4 +1,3 @@ -#! /usr/bin/env python """Testing helpers.""" # Copyright (C) 2012 Canonical Ltd. @@ -24,30 +23,21 @@ import io import os import shutil -import sys import tempfile -try: - import unittest2 as unittest -except ImportError: - import unittest - -from germinate.seeds import SeedStructure +from fixtures import FakeLogger +import testtools -if sys.version >= "3": - def u(s): - return s -else: - def u(s): - return unicode(s, "unicode_escape") +from germinate.seeds import SeedStructure -class TestCase(unittest.TestCase): +class TestCase(testtools.TestCase): def __init__(self, *args, **kwargs): - unittest.TestCase.__init__(self, *args, **kwargs) + super(TestCase, self).__init__(*args, **kwargs) self.temp_dir = None self.archive_dir = None self.seeds_dir = None + self.logger = self.useFixture(FakeLogger("germinate")) def useTempDir(self): if self.temp_dir is not None: @@ -128,14 +118,14 @@ seed_path = os.path.join(self.seeds_dir, seed_dist, seed_name) self.ensureParentDir(seed_path) with io.open(seed_path, "a", encoding="UTF-8") as seed: - print(u(" * %s") % pkg, file=seed) + print(u" * %s" % pkg, file=seed) def addSeedSnap(self, seed_dist, seed_name, pkg): self.setUpDirs() seed_path = os.path.join(self.seeds_dir, seed_dist, seed_name) self.ensureParentDir(seed_path) with io.open(seed_path, "a", encoding="UTF-8") as seed: - print(u(" * snap:%s") % pkg, file=seed) + print(u" * snap:%s" % pkg, file=seed) def openSeedStructure(self, branch): return SeedStructure(branch, seed_bases=["file://%s" % self.seeds_dir]) diff -Nru germinate-2.31/germinate/tests/test_archive.py germinate-2.32/germinate/tests/test_archive.py --- germinate-2.31/germinate/tests/test_archive.py 2018-06-22 10:55:19.000000000 +0000 +++ germinate-2.32/germinate/tests/test_archive.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,4 +1,4 @@ -#! /usr/bin/env python +# -*- coding: utf-8 -*- """Unit tests for germinate.archive.""" # Copyright (C) 2012 Canonical Ltd. @@ -59,13 +59,13 @@ os.makedirs(source_dir) with gzip.GzipFile( os.path.join(binary_dir, "Packages.gz"), "wb") as packages: - packages.write(textwrap.dedent(b"""\ + packages.write(textwrap.dedent(u"""\ Package: test Version: 1.0 Architecture: i386 - Maintainer: \xc3\xba\xe1\xb8\x83\xc3\xba\xc3\xb1\xc5\xa7\xc5\xaf\x20\xc4\x91\xc9\x99\x76\xe1\xba\xbd\xc5\x82\xc3\xb5\xe1\xb9\x97\xc3\xa8\xc5\x97\xe1\xb9\xa1 + Maintainer: úḃúñŧů đəvẽłõṗèŗṡ - """.decode("UTF-8")).encode("UTF-8")) + """).encode("UTF-8")) with gzip.GzipFile( os.path.join(source_dir, "Sources.gz"), "wb") as sources: sources.write(textwrap.dedent("""\ @@ -95,13 +95,13 @@ os.makedirs(source_dir) with bz2.BZ2File( os.path.join(binary_dir, "Packages.bz2"), "wb") as packages: - packages.write(textwrap.dedent(b"""\ + packages.write(textwrap.dedent(u"""\ Package: test Version: 1.0 Architecture: i386 - Maintainer: \xc3\xba\xe1\xb8\x83\xc3\xba\xc3\xb1\xc5\xa7\xc5\xaf\x20\xc4\x91\xc9\x99\x76\xe1\xba\xbd\xc5\x82\xc3\xb5\xe1\xb9\x97\xc3\xa8\xc5\x97\xe1\xb9\xa1 + Maintainer: úḃúñŧů đəvẽłõṗèŗṡ - """.decode("UTF-8")).encode("UTF-8")) + """).encode("UTF-8")) with bz2.BZ2File( os.path.join(source_dir, "Sources.bz2"), "wb") as sources: sources.write(textwrap.dedent("""\ @@ -130,13 +130,13 @@ os.makedirs(binary_dir) os.makedirs(source_dir) with open(os.path.join(binary_dir, "Packages"), "wb") as packages: - packages.write(textwrap.dedent(b"""\ + packages.write(textwrap.dedent(u"""\ Package: test Version: 1.0 Architecture: i386 - Maintainer: \xc3\xba\xe1\xb8\x83\xc3\xba\xc3\xb1\xc5\xa7\xc5\xaf\x20\xc4\x91\xc9\x99\x76\xe1\xba\xbd\xc5\x82\xc3\xb5\xe1\xb9\x97\xc3\xa8\xc5\x97\xe1\xb9\xa1 + Maintainer: úḃúñŧů đəvẽłõṗèŗṡ - """.decode("UTF-8")).encode("UTF-8")) + """).encode("UTF-8")) subprocess.check_call(["xz", os.path.join(binary_dir, "Packages")]) with open(os.path.join(source_dir, "Sources"), "wb") as sources: sources.write(textwrap.dedent("""\ diff -Nru germinate-2.31/germinate/tests/test_germinator.py germinate-2.32/germinate/tests/test_germinator.py --- germinate-2.31/germinate/tests/test_germinator.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/tests/test_germinator.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,4 +1,3 @@ -#! /usr/bin/env python """Unit tests for germinate.germinator.""" # Copyright (C) 2012 Canonical Ltd. @@ -18,7 +17,7 @@ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. - +import logging import shutil from germinate.archive import TagFile @@ -32,7 +31,7 @@ RescueReason, SeedReason, ) -from germinate.tests.helpers import TestCase, u +from germinate.tests.helpers import TestCase class TestSeedReason(TestCase): @@ -155,7 +154,7 @@ self.assertIn("hello", germinator._sources) self.assertEqual({ - "Maintainer": u("Test Person "), + "Maintainer": u"Test Person ", "Version": "1.0-1", "Build-Depends": [], "Build-Depends-Indep": [], @@ -166,7 +165,7 @@ self.assertEqual({ "Section": "", "Version": "1.0-1", - "Maintainer": u("Test Person "), + "Maintainer": u"Test Person ", "Essential": "", "Pre-Depends": [], "Built-Using": [], @@ -184,7 +183,7 @@ self.assertEqual({ "Section": "", "Version": "1.0-1", - "Maintainer": u(""), + "Maintainer": u"", "Essential": "", "Pre-Depends": [], "Built-Using": [], @@ -224,19 +223,19 @@ https://wiki.ubuntu.com/MultiarchSpec """ for ma, qual, allowed in ( - (None, "", True), - (None, ":any", False), - (None, ":native", False), - ("same", "", True), - ("same", ":any", False), - ("same", ":native", False), - ("foreign", "", True), - ("foreign", ":any", False), - ("foreign", ":native", False), - ("allowed", "", True), - ("allowed", ":any", True), - ("allowed", ":native", False), - ): + (None, "", True), + (None, ":any", False), + (None, ":native", False), + ("same", "", True), + ("same", ":any", False), + ("same", ":native", False), + ("foreign", "", True), + ("foreign", ":any", False), + ("foreign", ":native", False), + ("allowed", "", True), + ("allowed", ":any", True), + ("allowed", ":native", False), + ): self.addSource("precise", "main", "hello", "1.0-1", ["hello"]) self.addPackage("precise", "main", "i386", "hello", "1.0-1", fields={"Depends": "gettext%s" % qual}) @@ -276,19 +275,19 @@ https://wiki.ubuntu.com/MultiarchCross#Build_Dependencies """ for ma, qual, allowed in ( - (None, "", True), - (None, ":any", False), - (None, ":native", True), - ("same", "", True), - ("same", ":any", False), - ("same", ":native", True), - ("foreign", "", True), - ("foreign", ":any", False), - ("foreign", ":native", False), - ("allowed", "", True), - ("allowed", ":any", True), - ("allowed", ":native", True), - ): + (None, "", True), + (None, ":any", False), + (None, ":native", True), + ("same", "", True), + ("same", ":any", False), + ("same", ":native", True), + ("foreign", "", True), + ("foreign", ":any", False), + ("foreign", ":native", False), + ("allowed", "", True), + ("allowed", ":any", True), + ("allowed", ":native", True), + ): self.addSource("precise", "main", "hello", "1.0-1", ["hello"], fields={"Build-Depends": "gettext%s" % qual}) self.addPackage("precise", "main", "i386", "hello", "1.0-1") @@ -401,9 +400,6 @@ expected, germinator.get_depends(structure, "supported")) def test_snap(self): - import logging - from germinate.log import germinate_logging - germinate_logging(logging.INFO) branch = "collection.precise" self.addSeed(branch, "base") self.addSeedSnap(branch, "base", "hello") @@ -417,13 +413,10 @@ germinator.get_snaps(structure, "base")) def test_snap_recommends(self): - import logging - from germinate.log import germinate_logging - logger = germinate_logging(logging.INFO) branch = "collection.precise" self.addSeed(branch, "base") self.addSeedSnap(branch, "base", "(hello)") - with self.assertLogs(logger, level=logging.WARNING) as logs: + with self.assertLogs("germinate", level=logging.WARNING) as logs: germinator = Germinator("i386") structure = self.openSeedStructure(branch) germinator.plant_seeds(structure) diff -Nru germinate-2.31/germinate/tests/test_integration.py germinate-2.32/germinate/tests/test_integration.py --- germinate-2.31/germinate/tests/test_integration.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/tests/test_integration.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,4 +1,3 @@ -#! /usr/bin/env python """Integration tests for germinate.""" # Copyright (C) 2011, 2012 Canonical Ltd. @@ -18,22 +17,13 @@ # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA # 02110-1301, USA. -import logging - from germinate.scripts import germinate_main from germinate.tests.helpers import TestCase class TestGerminate(TestCase): - def addNullHandler(self): - handler = logging.NullHandler() - logger = logging.getLogger("germinate") - logger.addHandler(handler) - logger.propagate = False - def runGerminate(self, *args): self.useTempDir() - self.addNullHandler() argv = ["germinate"] argv.extend(["-S", "file://%s" % self.seeds_dir]) argv.extend(["-m", "file://%s" % self.archive_dir]) diff -Nru germinate-2.31/germinate/tests/test_lint.py germinate-2.32/germinate/tests/test_lint.py --- germinate-2.31/germinate/tests/test_lint.py 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/germinate/tests/test_lint.py 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,30 @@ +"""Lint tests.""" + +# Copyright (C) 2019 Canonical Ltd. +# +# Germinate is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# Germinate is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Germinate; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301, USA. + +import subprocess +import sys + +from germinate.tests.helpers import TestCase + + +class TestLint(TestCase): + + def test_flake8(self): + """flake8 output is clean.""" + subprocess.check_call([sys.executable, "-m", "flake8", "germinate"]) diff -Nru germinate-2.31/germinate/tests/test_seeds.py germinate-2.32/germinate/tests/test_seeds.py --- germinate-2.31/germinate/tests/test_seeds.py 2019-02-06 00:59:18.000000000 +0000 +++ germinate-2.32/germinate/tests/test_seeds.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,4 +1,3 @@ -#! /usr/bin/env python """Unit tests for germinate.seeds.""" # Copyright (C) 2012 Canonical Ltd. @@ -27,7 +26,7 @@ Seed, SingleSeedStructure, ) -from germinate.tests.helpers import TestCase, u +from germinate.tests.helpers import TestCase class TestAtomicFile(TestCase): @@ -49,6 +48,7 @@ class TestSeed(TestCase): def setUp(self): + super(TestSeed, self).setUp() self.addSeed("collection.dist", "test") self.addSeedPackage("collection.dist", "test", "foo") self.addSeed("collection.dist", "test2") @@ -280,9 +280,9 @@ """SeedStructure.write_seed_text handles UTF-8 text in seeds.""" branch = "collection.dist" self.addSeed(branch, "base") - self.addSeedPackage(branch, "base", u("base # \u00e4\u00f6\u00fc")) + self.addSeedPackage(branch, "base", u"base # \u00e4\u00f6\u00fc") structure = self.openSeedStructure(branch) structure.write_seed_text("base.seedtext", "base") with io.open("base.seedtext", encoding="UTF-8") as seed_file: self.assertEqual( - u(" * base # \u00e4\u00f6\u00fc\n"), seed_file.read()) + u" * base # \u00e4\u00f6\u00fc\n", seed_file.read()) diff -Nru germinate-2.31/germinate/tests/test_version.py germinate-2.32/germinate/tests/test_version.py --- germinate-2.31/germinate/tests/test_version.py 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/germinate/tests/test_version.py 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,28 @@ +"""Unit tests for germinate.version.""" + +# Copyright (C) 2019 Canonical Ltd. +# +# Germinate is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# Germinate is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Germinate; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301, USA. + +from germinate.tests.helpers import TestCase +from germinate.version import VERSION + + +class TestVersion(TestCase): + """Ensure that version.txt was properly included in the package.""" + + def test_not_local(self): + self.assertNotEqual('local', VERSION) diff -Nru germinate-2.31/germinate/tsort.py germinate-2.32/germinate/tsort.py --- germinate-2.31/germinate/tsort.py 2018-06-22 10:55:19.000000000 +0000 +++ germinate-2.32/germinate/tsort.py 2019-08-07 10:43:16.000000000 +0000 @@ -23,6 +23,8 @@ import sys +import six + __all__ = ["topo_sort", "TopoSorter"] @@ -44,7 +46,7 @@ if sys.version < '3': # __str__() should always return a 'str' object # never a 'unicode' object. - if isinstance(s, unicode): + if isinstance(s, six.text_type): return s.encode('utf8') return s @@ -87,7 +89,7 @@ # a dict of the graph. self._graph = dict(graph) self._visitable = set(self._graph) - ### if debugging: + # if debugging: # self._original_graph = dict(graph) # this is a stack storing the depth first search into the graph. @@ -108,15 +110,15 @@ """ return list(self.iter_topo_order()) -### Useful if fiddling with this code. -### # cross check -### sorted_names = list(self.iter_topo_order()) -### for index in range(len(sorted_names)): -### rev = sorted_names[index] -### for left_index in range(index): -### if rev in self.original_graph[sorted_names[left_index]]: -### print("revision in parent list of earlier revision") -### import pdb;pdb.set_trace() +# Useful if fiddling with this code. +# # cross check +# sorted_names = list(self.iter_topo_order()) +# for index in range(len(sorted_names)): +# rev = sorted_names[index] +# for left_index in range(index): +# if rev in self.original_graph[sorted_names[left_index]]: +# print("revision in parent list of earlier revision") +# import pdb;pdb.set_trace() def iter_topo_order(self): """Yield the nodes of the graph in a topological order. diff -Nru germinate-2.31/germinate/version.py germinate-2.32/germinate/version.py --- germinate-2.31/germinate/version.py 2018-06-22 10:55:19.000000000 +0000 +++ germinate-2.32/germinate/version.py 2019-08-07 10:43:16.000000000 +0000 @@ -1 +1,29 @@ -VERSION = '@VERSION@' +# Copyright (C) 2019 Canonical Ltd. +# +# Germinate is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2, or (at your option) any +# later version. +# +# Germinate is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Germinate; see the file COPYING. If not, write to the Free +# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA +# 02110-1301, USA. + +from __future__ import print_function + +try: + try: + from importlib.resources import read_binary as resource_bytes + except ImportError: + from pkg_resources import resource_string as resource_bytes +except ImportError: + VERSION = 'local' +else: + VERSION = resource_bytes( + 'germinate', 'version.txt').decode('UTF-8').rstrip('\n') diff -Nru germinate-2.31/germinate/version.txt germinate-2.32/germinate/version.txt --- germinate-2.31/germinate/version.txt 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/germinate/version.txt 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1 @@ +2.32 diff -Nru germinate-2.31/.gitignore germinate-2.32/.gitignore --- germinate-2.31/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/.gitignore 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,12 @@ +/.tox +/build +debhelper/*.1 +debian/files +debian/germinate +debian/python3-germinate +debian/tmp +debian/*.debhelper* +debian/*.substvars +germinate.egg-info +germinate/**/*.pyc +germinate/**/__pycache__ diff -Nru germinate-2.31/MANIFEST.in germinate-2.32/MANIFEST.in --- germinate-2.31/MANIFEST.in 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/MANIFEST.in 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1 @@ +recursive-include germinate *.txt diff -Nru germinate-2.31/run-pychecker germinate-2.32/run-pychecker --- germinate-2.31/run-pychecker 2015-05-18 02:34:15.000000000 +0000 +++ germinate-2.32/run-pychecker 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#! /bin/sh -set -e - -if ! which pychecker >/dev/null 2>&1; then - echo "pychecker not installed, so not running it" >&2 - exit 0 -fi - -cleanup () { - find germinate -name tests -prune -o -type f \( -name \*.pyc -o -name \*.pyo \) -print0 | xargs -0r rm -f -} -trap cleanup EXIT HUP INT QUIT TERM - -ret=0 -for x in $(find germinate -name tests -prune -o -name \*.py -printf '%p\n' | sort); do - pychecker "$x" | grep "^$x:" && ret=1 -done - -exit $ret diff -Nru germinate-2.31/setup.cfg germinate-2.32/setup.cfg --- germinate-2.31/setup.cfg 2015-05-18 02:34:15.000000000 +0000 +++ germinate-2.32/setup.cfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -[build] -pod2man=True diff -Nru germinate-2.31/setup.py germinate-2.32/setup.py --- germinate-2.31/setup.py 2018-06-22 10:55:19.000000000 +0000 +++ germinate-2.32/setup.py 2019-08-07 10:43:16.000000000 +0000 @@ -1,84 +1,13 @@ #! /usr/bin/env python import os -import re -import subprocess -import sys -from distutils.command.build import build from distutils.command.clean import clean -from setuptools import setup, Command, find_packages -from setuptools.command.install import install -from setuptools.command.test import test +from setuptools import setup, find_packages -# We probably ought to use debian.changelog, but let's avoid that dependency -# unless and until Germinate needs it somewhere else. -changelog_heading = re.compile(r'\w[-+0-9a-z.]* \(([^\(\) \t]+)\)') - -with open('debian/changelog') as changelog: - line = changelog.readline() - match = changelog_heading.match(line) - if match is None: - raise ValueError( - "Failed to parse first line of debian/changelog: '%s'" % line) - germinate_version = match.group(1) - - -class build_extra(build): - def __init__(self, dist): - build.__init__(self, dist) - - self.user_options.extend([('pod2man', None, 'use pod2man')]) - - def initialize_options(self): - build.initialize_options(self) - self.pod2man = False - - def finalize_options(self): - def has_pod2man(command): - return self.pod2man == 'True' - - build.finalize_options(self) - self.sub_commands.append(('build_pod2man', has_pod2man)) - - -class build_pod2man(Command): - description = "build POD manual pages" - - user_options = [('pod-files=', None, 'POD files to build')] - - def initialize_options(self): - self.pod_files = [] - - def finalize_options(self): - pass - - def run(self): - for pod_file in self.distribution.scripts: - if not pod_file.startswith('debhelper/'): - continue - if os.path.exists('%s.1' % pod_file): - continue - self.spawn(['pod2man', '-c', 'Debhelper', '-r', germinate_version, - pod_file, '%s.1' % pod_file]) - - -class test_extra(test): - def run(self): - # Only useful for Python 2 right now. - if sys.version_info[0] < 3: - self.spawn(['./run-pychecker']) - - test.run(self) - - -class install_extra(install): - def run(self): - install.run(self) - - self.spawn(['sed', '-i', 's/@VERSION@/%s/' % germinate_version, - os.path.join(self.install_lib, 'germinate', 'version.py')]) +with open('germinate/version.txt') as version_file: + germinate_version = version_file.read().strip() class clean_extra(clean): @@ -97,16 +26,13 @@ f = os.path.join(path, f) if f.endswith('.pyc'): self.spawn(['rm', f]) - elif f.startswith('./debhelper') and f.endswith('.1'): - self.spawn(['rm', f]) -perl_vendorlib = subprocess.Popen( - ['perl', '-MConfig', '-e', 'print $Config{vendorlib}'], - stdout=subprocess.PIPE, universal_newlines=True).communicate()[0] -if not perl_vendorlib: - raise ValueError("Failed to get $Config{vendorlib} from perl") -perllibdir = '%s/Debian/Debhelper/Sequence' % perl_vendorlib +tests_require = [ + 'fixtures', + 'flake8', + 'testtools', + ] setup( @@ -120,27 +46,22 @@ url='https://wiki.ubuntu.com/Germinate', license='GNU GPL', packages=find_packages(), + install_requires=['six'], + tests_require=tests_require, + extras_require={'test': tests_require}, scripts=[ 'bin/germinate', 'bin/germinate-pkg-diff', 'bin/germinate-update-metapackage', - 'debhelper/dh_germinate_clean', - 'debhelper/dh_germinate_metapackage', ], + include_package_data=True, data_files=[ - (perllibdir, ['debhelper/germinate.pm']), - ('/usr/share/man/man1', [ + ('share/man/man1', [ 'man/germinate.1', 'man/germinate-pkg-diff.1', 'man/germinate-update-metapackage.1', - 'debhelper/dh_germinate_clean.1', - 'debhelper/dh_germinate_metapackage.1', ])], cmdclass={ - 'build': build_extra, - 'build_pod2man': build_pod2man, - 'test': test_extra, - 'install': install_extra, 'clean': clean_extra, }, test_suite='germinate.tests', diff -Nru germinate-2.31/tox.ini germinate-2.32/tox.ini --- germinate-2.31/tox.ini 1970-01-01 00:00:00.000000000 +0000 +++ germinate-2.32/tox.ini 2019-08-07 10:43:16.000000000 +0000 @@ -0,0 +1,10 @@ +[tox] +# Note that only environments where you have a suitable version of +# python-apt installed on the host system will work. +envlist = py27,py33,py34,py35,py36,py37 + +[testenv] +sitepackages = true +deps = .[test] +commands = + python -m unittest {posargs:discover}