script: convert print func to be py2/py3 compatible
authorNoel Power <noel.power@suse.com>
Fri, 9 Mar 2018 14:06:21 +0000 (14:06 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 23 Mar 2018 06:28:24 +0000 (07:28 +0100)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
script/autobuild.py
script/compare_cc_results.py

index fe1a96104fed8bacd0cdcae34a20e5d36b6897f2..3a8ebe57cd151ef0a430810d822dd03492817571 100755 (executable)
@@ -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)
index 1ab92490426a1e6c6336134104794ba755b7f0a6..17b43f08d432d5c84810500787c4862a3b6e60d7 100755 (executable)
@@ -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