From aa439429c761919e06fd048a253555a6baced4f6 Mon Sep 17 00:00:00 2001 From: Olav Vitters Date: Tue, 8 Sep 2015 22:01:04 +0200 Subject: python3 fixes --- mgagnome | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mgagnome b/mgagnome index 5857803..142296d 100755 --- a/mgagnome +++ b/mgagnome @@ -354,6 +354,7 @@ class SpecFile(object): ('remove unneeded setup option', None, re.compile(r'^(?P\%setup -q )-n (?:\%name|\%\{name\})-(?:\%version|\%\{version\})(?P\n)', re.MULTILINE + re.IGNORECASE)), ('https for download.gnome.org', r'\ghttps://\g', re.compile(r'^(?PSource[0-9]*[ \t]*:[^\n]+)http://(?Pdownload.gnome.org/[^\n]+\n)', re.MULTILINE + re.IGNORECASE)), ('download.gnome.org instead of ftp.gnome.org', r'\ghttps://download.gnome.org\g', re.compile(r'^(?PSource[0-9]*[ \t]*:[^\n]+)(?:ftp|http|https)://ftp.gnome.org/pub/GNOME(?P/[^\n]+\n)', re.MULTILINE + re.IGNORECASE)), + ('restrict what libraries are matched with major numbers', r'\g.\g', re.compile(r'^(?P%{_libdir}[^\n]+})(?P\*)$', re.MULTILINE)) ] re_convert_br = [ ('remove py_requires', ('python',), re.compile(r'^\%(?:py_requires|\{py_requires\})[ \t]*\n', re.MULTILINE)), @@ -683,6 +684,7 @@ class SpecFile(object): self._changes.append('SILENT %s' % change_description) elif len(changes) != 0: print("ERROR: Could not update buildrequires!", file=sys.stderr) + print(changes) return False # Overwrite file with new version number @@ -1346,18 +1348,18 @@ def cmd_clean_spec_multi(args): convert_brs = { 'pkgconfig': { 'desc': 'convert -devel buildrequires into pkgconfig', - 'check_br': lambda req: req.endswith('-devel'), + 'check_br': lambda req: req.endswith(b'-devel'), 'check_provide': lambda prov: prov.startswith('pkgconfig('), 'basereq': lambda req: req[:-len('-devel')], 'extra': lambda basereq: [ 'pkgconfig(%s)' % basereq, - 'pkgconfig(%s)' % basereq[len('lib'):] if basereq.startswith('lib') else 'pkgconfig(lib%s)' % basereq + 'pkgconfig(%s)' % basereq[len('lib'):] if basereq.startswith(b'lib') else 'pkgconfig(lib%s)' % basereq ], }, 'perl': { 'desc': 'convert perl- buildrequires into perl()', - 'check_br': lambda req: req.startswith('perl-'), - 'check_provide': lambda prov: prov.startswith('perl('), + 'check_br': lambda req: req.startswith(b'perl-'), + 'check_provide': lambda prov: prov.startswith(b'perl('), 'basereq': lambda req: req[len('perl-'):], 'extra': lambda basereq: ['perl(%s)' % basereq.replace('-', '::')], } @@ -1424,8 +1426,12 @@ def cmd_clean_spec(options, parser): else: packages = options.package if len(options.package) else (l[0] for l in join_streams()) + with concurrent.futures.ThreadPoolExecutor(max_workers=8) as executor: executor.map(cmd_clean_spec_multi, ((options, package) for package in packages)) +# DEBUG: +# for package in packages: +# cmd_clean_spec_multi((options, package)) def cmd_package_new_version(options, parser): # Determine the package name @@ -1553,7 +1559,8 @@ def cmd_parse_ftp_release_list(options, parser): try: packages = Downstream().get_downstream_from_upstream(module, version) except ValueError as e: - print("ERROR: %s" % e, file=stderr) + #print(bytes("ERROR: %s" % str(e), 'UTF-8'), file=stderr) + stderr.write(bytes("ERROR: %s" % str(e), 'UTF-8')) if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) sys.exit(1) -- cgit v1.2.1