commit 2afc7e6d2f14583ce97ed090ebcee4342757f7f3
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Nov 26 16:07:18 2015 +0100
Call the print function instead of the print statement to be py3 compatible
pkgdb2client/__init__.py | 2 +-
pkgdb2client/admin.py | 50 +++++++++++++++++++++++-----------------------
pkgdb2client/cli.py | 8 +++---
pkgdb2client/utils.py | 4 +-
4 files changed, 32 insertions(+), 32 deletions(-)
---
diff --git a/pkgdb2client/__init__.py b/pkgdb2client/__init__.py
index f229fec..85405a4 100644
--- a/pkgdb2client/__init__.py
+++ b/pkgdb2client/__init__.py
@@ -89,7 +89,7 @@ def ask_password(username=None, bad_password=False):
:rtype: tuple
"""
if bad_password:
- print "Bad password, please retry"
+ print("Bad password, please retry")
if not username:
try:
username = fedora_cert.read_user_cert()
diff --git a/pkgdb2client/admin.py b/pkgdb2client/admin.py
index f93ac93..348b7c8 100644
--- a/pkgdb2client/admin.py
+++ b/pkgdb2client/admin.py
@@ -192,7 +192,7 @@ def do_info(args):
LOG.info("action : {0}".format(actionid))
action = PKGDBCLIENT.handle_api_call('/admin/action/%s' % actionid)
- print _action2msg(action)
+ print(_action2msg(action))
def do_list(args):
@@ -218,10 +218,10 @@ def do_list(args):
ids = []
for action in data['actions']:
- print _action2msg(action)
+ print(_action2msg(action))
ids.append(action["id"])
- print 'Total: {0} actions'.format(len(ids))
+ print('Total: {0} actions'.format(len(ids)))
return ids
@@ -242,7 +242,7 @@ def do_update(args):
)
for msg in data.get('messages', []):
- print msg
+ print(msg)
def _ask_what_to_do(messages):
@@ -250,12 +250,12 @@ def _ask_what_to_do(messages):
what to do, ie: approve, deny, pass
'''
for message in messages:
- print message
+ print(message)
- print '\nWhat should we do about this requests?'
+ print('\nWhat should we do about this requests?')
action = raw_input('approve, deny, pass: ')
if action.lower() not in ['a', 'd', 'p', 'approve', 'deny', 'pass']:
- print 'No valid action specified, just ignoring for now'
+ print('No valid action specified, just ignoring for now')
action = 'pass'
return action.lower()
@@ -386,7 +386,7 @@ def do_process(args):
if not args.actionid:
args.status = "Awaiting Review"
- print 'Processing all requests with status: %s' % args.status
+ print('Processing all requests with status: %s' % args.status)
ids = do_list(args)
else:
ids = args.actionid
@@ -395,18 +395,18 @@ def do_process(args):
LOG.info("action : {0}".format(actionid))
action = PKGDBCLIENT.handle_api_call('/admin/action/%s' % actionid)
- print _action2msg(action)
+ print(_action2msg(action))
if action['status'] != 'Awaiting Review':
- print 'Action #%s is not Awaiting Review - Current status: %s' % (
- action['id'], action['status'])
+ print('Action #%s is not Awaiting Review - Current status: %s' % (
+ action['id'], action['status']))
return
if action['action'] == 'request.package':
try:
PKGDBCLIENT.get_package(action['info']['pkg_name'])
- print 'Package {0} found, requalifying request.package ' \
- 'in request.branch'.format(action['info']['pkg_name'])
+ print('Package {0} found, requalifying request.package ' \
+ 'in request.branch'.format(action['info']['pkg_name']))
# Adjusting the input format
action['action'] = 'request.branch'
action['package'] = {'name': action['info']['pkg_name']}
@@ -421,12 +421,12 @@ def do_process(args):
elif action['action'] == 'request.branch':
data = __handle_request_branch(actionid, action)
else:
- print 'Action %s not supported by pkgdb-cli' % action['action']
+ print('Action %s not supported by pkgdb-cli' % action['action'])
continue
for msg in data.get('messages', []):
- print msg
- print ''
+ print(msg)
+ print('')
def main():
@@ -437,7 +437,7 @@ def main():
try:
arg = parser.parse_args()
except argparse.ArgumentTypeError, err:
- print "\nError: {0}".format(err)
+ print("\nError: {0}".format(err))
return 2
logging.basicConfig()
@@ -478,30 +478,30 @@ def main():
try:
arg.func(arg)
except KeyboardInterrupt:
- print "\nInterrupted by user."
+ print("\nInterrupted by user.")
return_code = 1
except ServerError, err:
LOG.debug('ServerError')
- print '{0}'.format(err)
+ print('{0}'.format(err))
return_code = 3
except ActionError, err:
LOG.debug('ActionError')
- print '{0}'.format(err.message)
+ print('{0}'.format(err.message))
return_code = 7
except AppError, err:
LOG.debug('AppError')
- print '{0}: {1}'.format(err.name, err.message)
+ print('{0}: {1}'.format(err.name, err.message))
return_code = 4
except PkgDBException, err:
LOG.debug('PkgDBException')
- print '{0}'.format(err)
+ print('{0}'.format(err))
return_code = 8
except ValueError, err:
- print 'Error: {0}'.format(err)
- print 'Did you log in?'
+ print('Error: {0}'.format(err))
+ print('Did you log in?')
return_code = 6
except Exception, err:
- print 'Error: {0}'.format(err)
+ print('Error: {0}'.format(err))
logging.exception("Generic error catched:")
return_code = 5
diff --git a/pkgdb2client/cli.py b/pkgdb2client/cli.py
index 0366ad2..645cd8a 100644
--- a/pkgdb2client/cli.py
+++ b/pkgdb2client/cli.py
@@ -832,12 +832,12 @@ def do_koschei(args):
pkg = pkgdbclient.get_package(
args.package, branches='master', acls=False
)['packages'][0]['package']
- print "Current koschei monitoring status of {0} is: {1}".format(
- pkg['name'], pkg['koschei_monitor'])
+ print("Current koschei monitoring status of {0} is: {1}".format(
+ pkg['name'], pkg['koschei_monitor']))
else:
output = pkgdbclient.set_koschei_status(args.package, args.koschei)
- print output.get(
- 'messages', 'Invalid output returned, please contact an admin')
+ print(output.get(
+ 'messages', 'Invalid output returned, please contact an admin'))
def main():
diff --git a/pkgdb2client/utils.py b/pkgdb2client/utils.py
index 9efb214..d764771 100644
--- a/pkgdb2client/utils.py
+++ b/pkgdb2client/utils.py
@@ -59,8 +59,8 @@ def _get_bz():
def bz_login():
''' Login on bugzilla. '''
- print 'To keep going, we need to authenticate against bugzilla' \
- ' at {0}'.format(RH_BZ_API)
+ print('To keep going, we need to authenticate against bugzilla' \
+ ' at {0}'.format(RH_BZ_API))
username = raw_input("Bugzilla user: ")
password = getpass.getpass("Bugzilla password: ")