Index: lnt/trunk/docs/conf.py =================================================================== --- lnt/trunk/docs/conf.py +++ lnt/trunk/docs/conf.py @@ -11,6 +11,7 @@ # All configuration values have a default; values that are commented out # serve to show the default. +from __future__ import print_function import datetime import sys import os @@ -20,7 +21,7 @@ try: import sphinx_bootstrap_theme except ImportError: - print "Warning: Sphinx Bootstrap Theme package is not installed!" + print("Warning: Sphinx Bootstrap Theme package is not installed!") use_bootstrap = False # If extensions (or modules to document with autodoc) are in another directory, Index: lnt/trunk/examples/functions.py =================================================================== --- lnt/trunk/examples/functions.py +++ lnt/trunk/examples/functions.py @@ -3,6 +3,7 @@ Simple example of a test generator which just produces data on some mathematical functions, keyed off of the current time. """ +from __future__ import print_function from lnt.testing import Machine, Run, TestSamples, Report import math import random @@ -47,7 +48,7 @@ report = Report(machine, run, tests) - print >>output, report.render() + print(report.render(), file=output) if output is not sys.stderr: output.close() Index: lnt/trunk/examples/run_to_csv.py =================================================================== --- lnt/trunk/examples/run_to_csv.py +++ lnt/trunk/examples/run_to_csv.py @@ -1,4 +1,5 @@ """Convert the JSON run file passed on stdin to a csv""" +from __future__ import print_function import json import sys @@ -9,11 +10,11 @@ titles = data['tests'].itervalues().next().keys() titles.insert(0, titles.pop(titles.index("name"))) -print ", ".join(titles) +print(", ".join(titles)) for i, result in data['tests'].items(): for title in titles: - print result[title], - print ", ", - print + print(result[title], end=' ') + print(", ", end=' ') + print() Index: lnt/trunk/tests/SharedInputs/FakeCompilers/fakecompiler.py =================================================================== --- lnt/trunk/tests/SharedInputs/FakeCompilers/fakecompiler.py +++ lnt/trunk/tests/SharedInputs/FakeCompilers/fakecompiler.py @@ -3,6 +3,7 @@ """ Utilities for "faking" a compiler response. """ +from __future__ import print_function import inspect import os @@ -24,34 +25,34 @@ raise NotImplementedError def print_as_version(self): - print >> sys.stderr, """(assembler version goes here)""" + print("""(assembler version goes here)""", file=sys.stderr) def print_ld_version(self): - print >> sys.stderr, """(linker version goes here)""" + print("""(linker version goes here)""", file=sys.stderr) class ICCv12_1_3(FakeCompiler): compiler_name = "icc-12.1.3" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ icc: command line warning #10006: ignoring unknown option '-###' icc version 12.1.3 (gcc version 4.2.1 compatibility) /usr/bin/icc-2011-base/bin/intel64/mcpcom -_g -mP3OPT_inline_alloca -D__HONOR_STD -D__ICC=1210 -D__INTEL_COMPILER=1210 "-_Acpu(x86_64)" "-_Amachine(x86_64)" -D__BLOCKS__ -D__PTRDIFF_TYPE__=long "-D__SIZE_TYPE__=unsigned long" -D__WCHAR_TYPE__=int -D__WINT_TYPE__=int "-D__INTMAX_TYPE__=long int" "-D__UINTMAX_TYPE__=long unsigned int" -D__LONG_MAX__=9223372036854775807L -D__QMSPP_ -D__OPTIMIZE__ -D__NO_MATH_INLINES -D__NO_STRING_INLINES -D__NO_INLINE__ -D__GNUC_GNU_INLINE__ -D__GNUC__=4 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=1 -D__APPLE_CC__=5658 -D__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__=1073 -D__LITTLE_ENDIAN__ -D__DYNAMIC__ "-D__private_extern__=__attribute__((visibility("hidden")))" -D__LP64__ -D_LP64 -D__GXX_ABI_VERSION=1002 -D__USER_LABEL_PREFIX__=_ -D__REGISTER_PREFIX__= -D__INTEL_RTTI__ -D__x86_64 -D__x86_64__ -D_MT -D__INTEL_COMPILER_BUILD_DATE=20120130 -D__PIC__ -D__APPLE__ -D__MACH__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE__ -D__MMX__ -_k -_8 -_l -_D -_a -_b -E --gnu_version=421 -_W5 --gcc-extern-inline --multibyte_chars --blocks --array_section --simd --simd_func -mP1OPT_print_version=FALSE -mP1OPT_version=12.1-intel64 -mGLOB_diag_use_message_catalog=FALSE /dev/null ... more boring stuff here ... -""" # noqa +""", file=sys.stderr) # noqa def print_llvm_target(self, args): - print """\ + print("""\ icc: command line warning #10006: ignoring unknown option '-flto' .file "null" .section __DATA, __data # End .subsections_via_symbols -""" # noqa +""") # noqa def print_dumpmachine(self): - print """i686-apple-darwin11""" + print("""i686-apple-darwin11""") class LLVMCompiler(FakeCompiler): @@ -60,16 +61,16 @@ for arg in args: if arg.startswith("--target="): target = arg[len("--target="):] - print """\ + print("""\ ; ModuleID = '/dev/null' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-\ f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-\ n8:16:32:64" target triple = "%s" -""" % target +""" % target) def print_dumpmachine(self): - print """x86_64-apple-darwin11.0.0""" + print("""x86_64-apple-darwin11.0.0""") # Clang build at r154331 (for example). @@ -77,30 +78,30 @@ compiler_name = "clang-r154331" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ clang version 3.1 (trunk 154331) (llvm/trunk 154329) Target: x86_64-apple-darwin11.3.0 Thread model: posix InstalledDir: /home/foo/bin -""" - print >> sys.stderr, """\ +""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) class Clang_r154332(LLVMCompiler): compiler_name = "clang-r154332" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ clang version 3.1 (trunk 154332) (llvm/trunk 154329) Target: x86_64-apple-darwin11.3.0 Thread model: posix InstalledDir: /home/foo/bin -""" - print >> sys.stderr, """\ +""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) # Clang build from a git repository. @@ -108,17 +109,17 @@ compiler_name = "clang-git" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ clang version 3.1\ (git:/git/clang.git 37ce0feee598d82e7220fa0a4b110619cae6ea72)\ (git:/git/llvm.git 60fca4f64e697ad834ce7ee8c2e478cae394c7dc) Target: arm-apple-darwin11.4.0 Thread model: posix InstalledDir: /home/foo/bin -""" - print >> sys.stderr, """\ +""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) # Clang build from a git repository. @@ -126,29 +127,29 @@ compiler_name = "clang-git-2" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ clang version 3.2\ (/d/g/pz/clang.git git:/git/pz/clang.git 8ab09316f63ea99ff23b2684c454b1008b8d5f10)\ (http://llvm.org/git/llvm.git /d/g/pz/llvm.git git:/git/pb/llvm.git 7c53f795961cc2d35b85d315aadb2ac135a0fdb2) Target: x86_64-apple-darwin12.2.0 -Thread model: posix""" - print >> sys.stderr, """\ +Thread model: posix""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) class AppleClang_138_1(LLVMCompiler): compiler_name = "apple-clang-138.1" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ Apple clang version 2.0 (tags/Apple/clang-138.1) (based on LLVM 2.9svn) Target: x86_64-apple-darwin11.3.0 Thread model: posix -InstalledDir: /home/foo/bin""" - print >> sys.stderr, """\ +InstalledDir: /home/foo/bin""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) fake_compilers = dict((value.compiler_name, value) @@ -160,26 +161,26 @@ compiler_name = "clang-no-info" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ clang version 3.2 Target: x86_64-bla-bla -Thread model: posix""" - print >> sys.stderr, """\ +Thread model: posix""", file=sys.stderr) + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) class GenericLLVMCompiler(LLVMCompiler): compiler_name = "llvm-compiler" def print_verbose_info(self): - print >> sys.stderr, """\ + print("""\ LLVM version 3.3 (git:/git/pz/clang.git 597522d740374f093a089a2acbec5b20466b2f34) (/d/g/pz/llvm git:/git/pz/llvm.git 6e95d969734af111bb33bcec0bcc27fd803a3b76) Target: x86_64-apple-darwin12.3.0 -Thread model: posix""" # noqa - print >> sys.stderr, """\ +Thread model: posix""", file=sys.stderr) # noqa + print("""\ "%s" "-cc1" "-E" ... more boring stuff here ...""" % ( - g_program,) + g_program,), file=sys.stderr) fake_compilers = dict((value.compiler_name, value) Index: lnt/trunk/tests/SharedInputs/create_temp_instance.py =================================================================== --- lnt/trunk/tests/SharedInputs/create_temp_instance.py +++ lnt/trunk/tests/SharedInputs/create_temp_instance.py @@ -1,3 +1,4 @@ +from __future__ import print_function import sys import shutil import os.path @@ -69,7 +70,7 @@ cmd = "psql %s -f %s" % (db, tmpfile_name) else: cmd = "sqlite3 -batch %s < %s" % (db, sql_file) - print cmd + print(cmd) subprocess.check_call(cmd, shell="True") @@ -78,7 +79,7 @@ cmd = 'echo "%s" | psql %s' % (sql_cmd, db) else: cmd = 'echo "%s" | sqlite3 -batch %s' % (sql_cmd, db) - print cmd + print(cmd) subprocess.check_call(cmd, shell="True") @@ -109,7 +110,7 @@ def main(): usage = "%s test_name template_source_dir dest_dir [extra.sql]" if len(sys.argv) not in (4, 5): - print usage + print(usage) sys.exit(-1) if len(sys.argv) == 4: _, test_name, template_source_dir, dest_dir = sys.argv Index: lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py =================================================================== --- lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py +++ lnt/trunk/tests/server/db/ImportV4TestSuiteInstance.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Check the import process into a v4 test suite DB. # # We first construct a temporary LNT instance. @@ -107,8 +108,8 @@ orders = list(session.query(ts.Order).order_by(ts.Order.llvm_project_revision)) assert len(orders) == 2 order_a,order_b = orders -print order_a -print order_b +print(order_a) +print(order_b) assert order_a.previous_order_id is None assert order_a.next_order_id is order_b.id assert order_a.llvm_project_revision == '1' @@ -143,9 +144,9 @@ assert sample_a_0.test is test assert sample_a_1.test is test assert sample_b.test is test -print sample_a_0 -print sample_a_1 -print sample_b +print(sample_a_0) +print(sample_a_1) +print(sample_b) assert sample_a_0.compile_time == 0.019 assert sample_a_0.compile_status == lnt.testing.PASS assert sample_a_0.execution_time == 0.3 Index: lnt/trunk/tests/server/db/Migrations.py =================================================================== --- lnt/trunk/tests/server/db/Migrations.py +++ lnt/trunk/tests/server/db/Migrations.py @@ -2,6 +2,7 @@ # # RUN: python %s %t +from __future__ import print_function import logging import os import re @@ -31,7 +32,7 @@ test_suite_list_end = index.data.index("", test_suite_list_start) for ln in index.data[test_suite_list_start:test_suite_list_end].split("\n"): # Ignore non-matching lines. - print >>sys.stderr,ln + print(ln, file=sys.stderr) m = test_suite_link_rex.match(ln) if not m: continue Index: lnt/trunk/tests/server/ui/V4Pages.py =================================================================== --- lnt/trunk/tests/server/ui/V4Pages.py +++ lnt/trunk/tests/server/ui/V4Pages.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Perform basic sanity checking of the V4 UI pages. # # create temporary instance @@ -103,7 +104,7 @@ def dump_html(html_string): for linenr, line in enumerate(html_string.split('\n')): - print "%4d:%s" % (linenr + 1, line) + print("%4d:%s" % (linenr + 1, line)) def get_xml_tree(html_string): Index: lnt/trunk/tests/testing/CalltreeDataLoading.py =================================================================== --- lnt/trunk/tests/testing/CalltreeDataLoading.py +++ lnt/trunk/tests/testing/CalltreeDataLoading.py @@ -1,3 +1,4 @@ +from __future__ import print_function # Check the model bindings for test suite instances. # # RUN: rm -f %t.db @@ -8,7 +9,7 @@ from lnt.testing.util import valgrind data = valgrind.CalltreeData.frompath(sys.argv[1]) -print data +print(data) assert data.command == 'true' assert tuple(data.events) == ('Ir', 'I1mr', 'ILmr', 'Dr', 'D1mr', 'DLmr', Index: lnt/trunk/tests/utils/blast.py =================================================================== --- lnt/trunk/tests/utils/blast.py +++ lnt/trunk/tests/utils/blast.py @@ -4,6 +4,7 @@ This should only be used for (load) testing. It will add a bunch of bad data to your instance, so don't use it on a production instance. """ +from __future__ import print_function ## Just to make sure there are no syntax errors in this. This does not ## actually run a blast. # RUN: python %{src_root}/tests/utils/blast.py @@ -36,7 +37,7 @@ assert os.path.exists(fname) cmd = "lnt submit --verbose {url} {file}".format( url=url, file=fname) - print "Calling " + cmd + print("Calling " + cmd) subprocess.check_call(cmd, shell=True) @@ -61,7 +62,7 @@ run_info['run_order'] = tstamp if len(sys.argv) < 3: - print "Usage: python blast.py [optional url]" + print("Usage: python blast.py [optional url]") sys.exit(0) for i in xrange(int(sys.argv[1])): @@ -76,7 +77,7 @@ f_os, fname = tempfile.mkstemp(text=True, suffix='.json', prefix='lnt-stats-') f = os.fdopen(f_os, "w") - print >> f, report.render() + print(report.render(), file=f) f.close() local = "http://localhost:8000/db_default/submitRun" if len(sys.argv) == 4: