[PATCH] D57744: Python3 support: print-statement

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 5 04:56:19 PST 2019


serge-sans-paille updated this revision to Diff 185285.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57744/new/

https://reviews.llvm.org/D57744

Files:
  ABI-Testsuite/linux-x86.py
  LNTBased/lib/spec.py


Index: LNTBased/lib/spec.py
===================================================================
--- LNTBased/lib/spec.py
+++ LNTBased/lib/spec.py
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 # -*- Python -*-
+from __future__ import print_function
 
 import os
 import shutil
@@ -109,7 +110,7 @@
             with open(command_file, 'w') as f:
                 # Chdir here so that the redirects are put into CWD as well.
                 remote_command = 'cd %s\n%s\n' % (cwd, cmdstr)
-                print >>self.log, "command:", remote_command,
+                print("command:", remote_command, file=self.log, end=' ')
                 f.write(remote_command)
 
             st = os.stat(command_file)
@@ -155,10 +156,10 @@
             suitedir = os.path.join(suitedir, 'CPU' + self.year)
 
         self.datadir = os.path.join(suitedir, self.benchmark, 'data')
-        print >>self.log, "%s\n  options: %s\n\nmake variables: %s\n\n" % (self.testname, str(options), str(make_variables))
+        print("%s\n  options: %s\n\nmake variables: %s\n\n" % (self.testname, str(options), str(make_variables)), file=self.log)
 
         if not os.path.exists(self.datadir):
-            print >>self.log, "skipping, no source under externals"
+            print("skipping, no source under externals", file=self.log) 
             return []
 
         res = self.configure_test_suite(self.OBJROOT)
@@ -209,7 +210,7 @@
                 if result != 0:
                     return self.fail()
                 if not os.path.exists(os.path.join(pgo_dir, 'run_%d.profraw' % i)):
-                    print >>self.log, 'Failed to create PGO output'
+                    print('Failed to create PGO output', file=self.log)
                     return self.fail()
 
             llvm_profdata = os.path.join(os.path.dirname(CC), 'llvm-profdata')
Index: ABI-Testsuite/linux-x86.py
===================================================================
--- ABI-Testsuite/linux-x86.py
+++ ABI-Testsuite/linux-x86.py
@@ -1,6 +1,7 @@
 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 # See https://llvm.org/LICENSE.txt for license information.
 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+from __future__ import print_function
 import os
 import sys
 wopt = " -w"
@@ -71,22 +72,22 @@
 
 import subprocess
 if __name__ == "__main__":
-  print sys.argv
+  print(sys.argv)
   litargs = [sys.argv[0]] # args for lit.main
   c_compiler_name = sys.argv[1].strip()
   cxx_compiler_name = build_cxx_compiler_name(c_compiler_name)
   linker_name = build_linker_name(c_compiler_name)
-  #print "C++ compiler:", cxx_compiler_name
-  #print "linker :", linker_name
+  #print("C++ compiler:", cxx_compiler_name)
+  #print("linker :", linker_name)
   for la in sys.argv[2:]:
     litargs.append(la)
   sys.argv = litargs
   cmd = c_compiler_name.split() + [ "-o", "b.exe", "test/common/genselector.c"]
-  #print "cmd = ", cmd
+  #print("cmd = ", cmd)
   rv = subprocess.call(cmd)
-  #print "rv = " , rv
+  #print("rv = " , rv)
   if rv != 0:
-    print "compiler failed: ", cmd
+    print("compiler failed: ", cmd)
     sys.exit(1)
   rv = subprocess.call("./b.exe")
   fp = open("nselector.h")
@@ -105,14 +106,14 @@
   test_params["linker"] = linker_name
   test_params["Platform"] = "linux-" + cmd[0]
 
-  print "test_params = " , test_params
+  print("test_params = " , test_params)
   builtin_parameters = {
     'build_mode' : "Release",
     'llvm_site_config' : os.path.join(os.getcwd(), 'lit.site.cfg'),
     'clang_site_config': os.path.join(os.getcwd(), 'lit.site.cfg'),
     'test_params' : test_params
     }
-  #print "builtin_params = " , test_params
+  #print("builtin_params = " , test_params)
   from lit.main import main
   main(builtin_parameters)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57744.185285.patch
Type: text/x-patch
Size: 3779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190205/ac022fb1/attachment.bin>


More information about the llvm-commits mailing list