Skip to content

Commit eb249d0

Browse files
author
Serge Guelton
committed
Python Compat: print statements
Differential Revision: https://reviews.llvm.org/D57744 llvm-svn: 353169
1 parent ce298fe commit eb249d0

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

ABI-Testsuite/linux-x86.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
from __future__ import print_function
45
import os
56
import sys
67
wopt = " -w"
@@ -71,22 +72,22 @@ def build_linker_name(cn):
7172

7273
import subprocess
7374
if __name__ == "__main__":
74-
print sys.argv
75+
print(sys.argv)
7576
litargs = [sys.argv[0]] # args for lit.main
7677
c_compiler_name = sys.argv[1].strip()
7778
cxx_compiler_name = build_cxx_compiler_name(c_compiler_name)
7879
linker_name = build_linker_name(c_compiler_name)
79-
#print "C++ compiler:", cxx_compiler_name
80-
#print "linker :", linker_name
80+
#print("C++ compiler:", cxx_compiler_name)
81+
#print("linker :", linker_name)
8182
for la in sys.argv[2:]:
8283
litargs.append(la)
8384
sys.argv = litargs
8485
cmd = c_compiler_name.split() + [ "-o", "b.exe", "test/common/genselector.c"]
85-
#print "cmd = ", cmd
86+
#print("cmd = ", cmd)
8687
rv = subprocess.call(cmd)
87-
#print "rv = " , rv
88+
#print("rv = " , rv)
8889
if rv != 0:
89-
print "compiler failed: ", cmd
90+
print("compiler failed: ", cmd)
9091
sys.exit(1)
9192
rv = subprocess.call("./b.exe")
9293
fp = open("nselector.h")
@@ -105,14 +106,14 @@ def build_linker_name(cn):
105106
test_params["linker"] = linker_name
106107
test_params["Platform"] = "linux-" + cmd[0]
107108

108-
print "test_params = " , test_params
109+
print("test_params = " , test_params)
109110
builtin_parameters = {
110111
'build_mode' : "Release",
111112
'llvm_site_config' : os.path.join(os.getcwd(), 'lit.site.cfg'),
112113
'clang_site_config': os.path.join(os.getcwd(), 'lit.site.cfg'),
113114
'test_params' : test_params
114115
}
115-
#print "builtin_params = " , test_params
116+
#print("builtin_params = " , test_params)
116117
from lit.main import main
117118
main(builtin_parameters)
118119

LNTBased/lib/spec.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22
# -*- Python -*-
3+
from __future__ import print_function
34

45
import os
56
import shutil
@@ -109,7 +110,7 @@ def run_safely(self, args, **kwargs):
109110
with open(command_file, 'w') as f:
110111
# Chdir here so that the redirects are put into CWD as well.
111112
remote_command = 'cd %s\n%s\n' % (cwd, cmdstr)
112-
print >>self.log, "command:", remote_command,
113+
print("command:", remote_command, file=self.log, end=' ')
113114
f.write(remote_command)
114115

115116
st = os.stat(command_file)
@@ -155,10 +156,10 @@ def execute_test(self, options, make_variables, config):
155156
suitedir = os.path.join(suitedir, 'CPU' + self.year)
156157

157158
self.datadir = os.path.join(suitedir, self.benchmark, 'data')
158-
print >>self.log, "%s\n options: %s\n\nmake variables: %s\n\n" % (self.testname, str(options), str(make_variables))
159+
print("%s\n options: %s\n\nmake variables: %s\n\n" % (self.testname, str(options), str(make_variables)), file=self.log)
159160

160161
if not os.path.exists(self.datadir):
161-
print >>self.log, "skipping, no source under externals"
162+
print("skipping, no source under externals", file=self.log)
162163
return []
163164

164165
res = self.configure_test_suite(self.OBJROOT)
@@ -209,7 +210,7 @@ def execute_test(self, options, make_variables, config):
209210
if result != 0:
210211
return self.fail()
211212
if not os.path.exists(os.path.join(pgo_dir, 'run_%d.profraw' % i)):
212-
print >>self.log, 'Failed to create PGO output'
213+
print('Failed to create PGO output', file=self.log)
213214
return self.fail()
214215

215216
llvm_profdata = os.path.join(os.path.dirname(CC), 'llvm-profdata')

0 commit comments

Comments
 (0)