From 1e5da010ab8cb514b495eb7c1d3afce6baec7f4d Mon Sep 17 00:00:00 2001 From: "biao716.wang" Date: Fri, 28 Oct 2022 12:42:00 +0900 Subject: port code from python2.x to python3.x Change-Id: I798c72d07e44839cc5d1e25ec75fca0bd8068567 Signed-off-by: biao716.wang --- gbp/pkg/__init__.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'gbp/pkg') diff --git a/gbp/pkg/__init__.py b/gbp/pkg/__init__.py index 8162286b..320973d2 100644 --- a/gbp/pkg/__init__.py +++ b/gbp/pkg/__init__.py @@ -86,7 +86,7 @@ def parse_archive_filename(filename): base_name = ".".join(split[:-1]) (archive_fmt, compression) = (split[-1], None) else: - for (c, o) in compressor_opts.iteritems(): + for (c, o) in compressor_opts.items(): if o[1] == split[-1]: base_name = ".".join(split[:-1]) compression = c @@ -187,14 +187,13 @@ class PkgPolicy(object): version_chars = r'[a-zA-Z\d\.\~\-\:\+]' basename = parse_archive_filename(os.path.basename(filename))[0] - version_filters = map ( lambda x: x % version_chars, - ( # Debian upstream tarball: package_'.orig.tar.gz' + version_filters = [x % version_chars for x in ( # Debian upstream tarball: package_'.orig.tar.gz' r'^(?P[a-z\d\.\+\-]+)_(?P%s+)\.orig', # Debian native: 'package_.tar.gz' r'^(?P[a-z\d\.\+\-]+)_(?P%s+)', # Upstream 'package-.tar.gz' # or directory 'package-': - r'^(?P[a-zA-Z\d\.\+\-]+)(-)(?P[0-9]%s*)')) + r'^(?P[a-zA-Z\d\.\+\-]+)(-)(?P[0-9]%s*)')] if extra_regex: version_filters = extra_regex + version_filters @@ -509,7 +508,7 @@ class UpstreamSource(object): @staticmethod def known_compressions(): - return [ args[1][-1] for args in compressor_opts.items() ] + return [ args[1][-1] for args in list(compressor_opts.items()) ] def guess_version(self, extra_regex=r''): return self._pkg_policy.guess_upstream_src_version(self.path, -- cgit v1.2.3