Use more print from the future

This commit is contained in:
Stephan Kulow 2018-11-17 09:43:04 +01:00
parent 065ab5e00e
commit 2fe9701238
8 changed files with 31 additions and 17 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/python
from __future__ import print_function
from pprint import pprint
import os, sys, re
import logging

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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__':

View File

@ -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)

View File

@ -1,5 +1,7 @@
#!/usr/bin/python
from __future__ import print_function
import argparse
from lxml import etree as ET
from osc import conf