diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-02-28 21:56:33 +0200 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-02-28 21:56:33 +0200 |
commit | f62579f29303b33ff331f3f0b0e8d4197755d279 (patch) | |
tree | 06744ee5ccb2280970c8eed3303db326fbd5c128 /scripts/packages-formatter.py | |
parent | 611869b1035ef5677335a33169fb99413a90c3a6 (diff) | |
parent | 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff) |
Merge branch 'master' into DRTVWR-548-maint-N
Diffstat (limited to 'scripts/packages-formatter.py')
-rwxr-xr-x | scripts/packages-formatter.py | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/scripts/packages-formatter.py b/scripts/packages-formatter.py index b1eef3c721..ff7c892577 100755 --- a/scripts/packages-formatter.py +++ b/scripts/packages-formatter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """\ This module formats the package version and copyright information for the viewer and its dependent packages. @@ -37,6 +37,9 @@ parser.add_argument('version', help='viewer version number') args = parser.parse_args() _autobuild=os.getenv('AUTOBUILD', 'autobuild') +_autobuild_env=os.environ.copy() +# Coerce stdout encoding to utf-8 as cygwin's will be detected as cp1252 otherwise. +_autobuild_env["PYTHONIOENCODING"] = "utf-8" pkg_line=re.compile('^([\w-]+):\s+(.*)$') @@ -50,7 +53,7 @@ def autobuild(*args): try: child = subprocess.Popen(command, stdin=None, stdout=subprocess.PIPE, - universal_newlines=True) + universal_newlines=True, env=_autobuild_env) except OSError as err: if err.errno != errno.ENOENT: # Don't attempt to interpret anything but ENOENT @@ -110,20 +113,20 @@ for key, rawdata in ("versions", versions), ("copyrights", copyrights): break # Now that we've run through all of both outputs -- are there duplicates? -if any(pkgs for pkgs in dups.values()): - for key, pkgs in dups.items(): +if any(pkgs for pkgs in list(dups.values())): + for key, pkgs in list(dups.items()): if pkgs: - print >>sys.stderr, "Duplicate %s for %s" % (key, ", ".join(pkgs)) + print("Duplicate %s for %s" % (key, ", ".join(pkgs)), file=sys.stderr) sys.exit(1) -print "%s %s" % (args.channel, args.version) -print viewer_copyright +print("%s %s" % (args.channel, args.version)) +print(viewer_copyright) version = list(info['versions'].items()) version.sort() for pkg, pkg_version in version: - print ': '.join([pkg, pkg_version]) + print(': '.join([pkg, pkg_version])) try: - print info['copyrights'][pkg] + print(info['copyrights'][pkg]) except KeyError: sys.exit("No copyright for %s" % pkg) - print + print() |