Skip to content

Commit

Permalink
script: convert print func to be py2/py3 compatible
Browse files Browse the repository at this point in the history
Signed-off-by: Noel Power <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
Reviewed-by: Douglas Bagnall <[email protected]>
  • Loading branch information
noelpower authored and abartlet committed Mar 23, 2018
1 parent 220f19f commit 2a64f77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
13 changes: 7 additions & 6 deletions script/autobuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -277,7 +278,7 @@
}

def do_print(msg):
print "%s" % msg
print("%s" % msg)
sys.stdout.flush()
sys.stderr.flush()

Expand Down Expand Up @@ -452,9 +453,9 @@ def write_system_info(self):
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

Expand Down Expand Up @@ -847,7 +848,7 @@ def email_success(elapsed_time, log_base=None):
elapsed_time, log_base=options.log_base)
else:
elapsed_minutes = elapsed_time / 60.0
print '''
print('''
####################################################################
Expand All @@ -862,7 +863,7 @@ def email_success(elapsed_time, log_base=None):
####################################################################
''' % (options.branch, platform.node(), elapsed_minutes, failed_task, errstr)
''' % (options.branch, platform.node(), elapsed_minutes, failed_task, errstr))

cleanup()
do_print(errstr)
Expand Down
3 changes: 2 additions & 1 deletion script/compare_cc_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Compare the results of native and cross-compiled configure tests
#

from __future__ import print_function
import sys
import difflib

Expand Down Expand Up @@ -35,7 +36,7 @@
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
Expand Down

0 comments on commit 2a64f77

Please sign in to comment.