From 2a64f77d4f72e1c92562f7fa262cc2a4db413536 Mon Sep 17 00:00:00 2001 From: Noel Power Date: Fri, 9 Mar 2018 14:06:21 +0000 Subject: script: convert print func to be py2/py3 compatible Signed-off-by: Noel Power Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- script/autobuild.py | 13 +++++++------ script/compare_cc_results.py | 3 ++- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'script') diff --git a/script/autobuild.py b/script/autobuild.py index fe1a96104fe..3a8ebe57cd1 100755 --- a/script/autobuild.py +++ b/script/autobuild.py @@ -3,6 +3,7 @@ # Copyright Andrew Tridgell 2010 # released under GNU GPL v3 or later +from __future__ import print_function from subprocess import call, check_call,Popen, PIPE import os, tarfile, sys, time from optparse import OptionParser @@ -277,7 +278,7 @@ tasks = { } def do_print(msg): - print "%s" % msg + print("%s" % msg) sys.stdout.flush() sys.stderr.flush() @@ -452,9 +453,9 @@ class buildlist(object): filename = 'system-info.txt' f = open(filename, 'w') for cmd in ['uname -a', 'free', 'cat /proc/cpuinfo']: - print >>f, '### %s' % cmd - print >>f, run_cmd(cmd, output=True, checkfail=False) - print >>f + print('### %s' % cmd, file=f) + print(run_cmd(cmd, output=True, checkfail=False), file=f) + print(file=f) f.close() return filename @@ -847,7 +848,7 @@ if options.email is not None: elapsed_time, log_base=options.log_base) else: elapsed_minutes = elapsed_time / 60.0 - print ''' + print(''' #################################################################### @@ -862,7 +863,7 @@ the autobuild has been abandoned. Please fix the error and resubmit. #################################################################### -''' % (options.branch, platform.node(), elapsed_minutes, failed_task, errstr) +''' % (options.branch, platform.node(), elapsed_minutes, failed_task, errstr)) cleanup() do_print(errstr) diff --git a/script/compare_cc_results.py b/script/compare_cc_results.py index 1ab92490426..17b43f08d43 100755 --- a/script/compare_cc_results.py +++ b/script/compare_cc_results.py @@ -4,6 +4,7 @@ # Compare the results of native and cross-compiled configure tests # +from __future__ import print_function import sys import difflib @@ -35,7 +36,7 @@ for fname in sys.argv[1:]: if base_fname: diff = list(difflib.unified_diff(base_lines,lines,base_fname,fname)) if diff: - print 'configuration files %s and %s do not match' % (base_fname, fname) + print('configuration files %s and %s do not match' % (base_fname, fname)) for l in diff: sys.stdout.write(l) found_diff = True -- cgit v1.2.1