From: Kyr Shatskyy Date: Mon, 7 Oct 2019 10:58:33 +0000 (+0200) Subject: task/install: use future print for python3 compatibility X-Git-Tag: 1.1.0~223^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bef932d40f297a8b516b500a592449c18b9cda5d;p=teuthology.git task/install: use future print for python3 compatibility Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/task/install/daemon-helper b/teuthology/task/install/daemon-helper index 53455b928..986f44dc2 100755 --- a/teuthology/task/install/daemon-helper +++ b/teuthology/task/install/daemon-helper @@ -17,6 +17,8 @@ Usage: daemon-helper [--kill-group] [nostdin] COMMAND ... """ +from __future__ import print_function + import fcntl import os import select @@ -46,14 +48,14 @@ try: nostdin = True skip_nostdin = 1 except IndexError: - print 'No command specified' + print('No command specified') sys.exit(1) proc = None if nostdin: if len(args) - skip_nostdin == 0: - print 'No command specified' + print('No command specified') sys.exit(1) proc = subprocess.Popen( args=args[skip_nostdin:], @@ -95,18 +97,18 @@ while True: exitstatus = proc.wait() if exitstatus > 0: - print >>sys.stderr, '{me}: command failed with exit status {exitstatus:d}'.format( + print('{me}: command failed with exit status {exitstatus:d}'.format( me=os.path.basename(sys.argv[0]), exitstatus=exitstatus, - ) + ), file=sys.stderr) sys.exit(exitstatus) elif exitstatus < 0: if saw_eof and exitstatus == -end_signal: # suppress error from the exit we intentionally caused pass else: - print >>sys.stderr, '{me}: command crashed with signal {signal:d}'.format( + print('{me}: command crashed with signal {signal:d}'.format( me=os.path.basename(sys.argv[0]), signal=-exitstatus, - ) + ), file=sys.stderr) sys.exit(1)