From 2fe9701238919d8cdcdc5c3633c5c5a91425c258 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Sat, 17 Nov 2018 09:43:04 +0100 Subject: [PATCH] Use more print from the future --- ReviewBot.py | 2 ++ ToolBase.py | 4 +++- bugowner.py | 4 +++- checknewer.py | 2 ++ deptool.py | 8 +++++--- staging-report.py | 10 ++++++---- sync-rebuild.py | 16 ++++++++-------- unmaintained.py | 2 ++ 8 files changed, 31 insertions(+), 17 deletions(-) diff --git a/ReviewBot.py b/ReviewBot.py index 4db7e5f9..5ccd8425 100644 --- a/ReviewBot.py +++ b/ReviewBot.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + from pprint import pprint import os, sys, re import logging diff --git a/ToolBase.py b/ToolBase.py index 17fd3d30..6818c6c5 100644 --- a/ToolBase.py +++ b/ToolBase.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + from xml.etree import cElementTree as ET import cmdln import datetime @@ -55,7 +57,7 @@ class ToolBase(object): return http_GET(url) except HTTPError as e: if 500 <= e.code <= 599: - print 'Retrying {}'.format(url) + print('Retrying {}'.format(url)) time.sleep(1) return self.retried_GET(url) logging.error('%s: %s', e, url) diff --git a/bugowner.py b/bugowner.py index 9a0239c9..3ab5e644 100755 --- a/bugowner.py +++ b/bugowner.py @@ -20,6 +20,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +from __future__ import print_function + from ConfigParser import ConfigParser from xdg.BaseDirectory import load_first_config from lxml import etree as ET @@ -204,7 +206,7 @@ class CommandLineInterface(ToolBase.CommandLineInterface): continue person = self.tool.resolve_person(o.name) if person.email.endswith('@suse.com'): - print p, o.name + print(p, o.name) else: logger.debug('%s skipped', o.name) diff --git a/checknewer.py b/checknewer.py index 50fac3dd..71f7db65 100755 --- a/checknewer.py +++ b/checknewer.py @@ -1,6 +1,8 @@ #!/usr/bin/python2 # check if all packages in a repo are newer than all other repos +from __future__ import print_function + import sys import os import re diff --git a/deptool.py b/deptool.py index aaf492d2..81ff1d32 100755 --- a/deptool.py +++ b/deptool.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + from pprint import pprint import os import sys @@ -158,7 +160,7 @@ class DepTool(cmdln.Cmdln): return False for s in trans.newsolvables(): - print ','.join(packages), s.name + print(','.join(packages), s.name) if opts.explain and s.name in opts.explain: reason, rule = solver.describe_decision(s) ruleinfo = None @@ -310,7 +312,7 @@ class DepTool(cmdln.Cmdln): if kindid == solv.SOLVABLE_PROVIDES and r == s: continue if not kindprinted: - print kind + print(kind) kindprinted = True print(' {}: {}-{}@{}'.format(p, r.name, r.evr, r.arch)) @@ -338,7 +340,7 @@ class DepTool(cmdln.Cmdln): continue for r in sel.solvables(): if not kindprinted: - print kind + print(kind) kindprinted = True print(' {}-{}@{}'.format(r.name, r.evr, r.arch)) diff --git a/staging-report.py b/staging-report.py index 8442bb1a..c03459ea 100755 --- a/staging-report.py +++ b/staging-report.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + import argparse from datetime import datetime, timedelta from collections import defaultdict @@ -46,7 +48,7 @@ class StagingReport(object): if write_comment or force: if osc.conf.config['debug']: - print 'Updating comment' + print('Updating comment') if comment: self.comment.delete(comment['id']) self.comment.add_comment(project_name=project, comment=report) @@ -128,9 +130,9 @@ class StagingReport(object): self.update_status_comment(project, report, force=force, only_replace=only_replace) if osc.conf.config['debug']: - print project - print '-' * len(project) - print report + print(project) + print('-' * len(project)) + print(report) if __name__ == '__main__': diff --git a/sync-rebuild.py b/sync-rebuild.py index 14c77f49..871c7daf 100755 --- a/sync-rebuild.py +++ b/sync-rebuild.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + import sys import os import osc @@ -39,7 +41,7 @@ def compare_results(factory, rebuild, testmode): com_res = set(rebuild).symmetric_difference(set(factory)) if testmode != False: - print com_res + print(com_res) return com_res @@ -69,22 +71,22 @@ def rebuild_pkg_in_factory(package, prj, arch, testmode, code=None): u = osc.core.makeurl(osc.conf.config['apiurl'], ['build', prj], query=query) if testmode != False: - print "Trigger rebuild for this package: " + u + print("Trigger rebuild for this package: " + u) else: try: - print 'tried to trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg) + print('tried to trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg)) f = osc.core.http_POST(u) except: - print 'could not trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg) + print('could not trigger rebuild for project \'%s\' package \'%s\'' % (prj, pkg)) testmode = False try: if sys.argv[1] != None: if sys.argv[1] == '-test': testmode = True - print "testmode: "+str(testmode) + print("testmode: "+str(testmode)) else: testmode = False except: @@ -97,10 +99,8 @@ for arch in architectures: fact_result = check_pkgs(fact_result) result = compare_results(fact_result, rebuild_result, testmode) - print sorted(result) + print(sorted(result)) for package in result: rebuild_pkg_in_factory(package, 'openSUSE:Factory', arch, testmode, None) rebuild_pkg_in_factory(package, 'openSUSE:Factory:Rebuild', arch, testmode, None) - - diff --git a/unmaintained.py b/unmaintained.py index 0f3b4b53..8fb04570 100755 --- a/unmaintained.py +++ b/unmaintained.py @@ -1,5 +1,7 @@ #!/usr/bin/python +from __future__ import print_function + import argparse from lxml import etree as ET from osc import conf