From e3b86af463e2a9eef98cd7c74469a5fff96f19c9 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 28 Feb 2017 12:08:24 -0800 Subject: py2/3 fixes --- QMTest/TestSCons_time.py | 7 ++++--- test/scons-time/run/config/scons.py | 3 ++- test/scons-time/run/option/scons.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/QMTest/TestSCons_time.py b/QMTest/TestSCons_time.py index ba7fbd8..6778d1b 100644 --- a/QMTest/TestSCons_time.py +++ b/QMTest/TestSCons_time.py @@ -28,8 +28,9 @@ __all__.extend([ 'TestSCons_time', ]) SConstruct = """\ +from __future__ import print_function import os -print "SConstruct file directory:", os.getcwd() +print("SConstruct file directory:", os.getcwd()) """ scons_py = """\ @@ -43,7 +44,7 @@ def write_args(fp, args): write_args(sys.stdout, sys.argv) for arg in sys.argv[1:]: if arg[:10] == '--profile=': - profile = open(arg[10:], 'wb') + profile = open(arg[10:], 'w') profile.write('--profile\\n') write_args(profile, sys.argv) break @@ -270,7 +271,7 @@ class TestSCons_time(TestCommon): tar = tarfile.open(archive, mode[suffix]) for name, content in files: path = os.path.join(dir, name) - open(path, 'wb').write(content) + open(path, 'wb').write(bytearray(content,'utf-8')) tarinfo = tar.gettarinfo(path, path) tarinfo.uid = 111 tarinfo.gid = 111 diff --git a/test/scons-time/run/config/scons.py b/test/scons-time/run/config/scons.py index 73f041d..0c8b643 100644 --- a/test/scons-time/run/config/scons.py +++ b/test/scons-time/run/config/scons.py @@ -42,13 +42,14 @@ scons = r'%(my_scons_py)s' """ % locals()) test.write(my_scons_py, """\ +from __future__ import print_function import sys profile = '' for arg in sys.argv[1:]: if arg.startswith('--profile='): profile = arg[10:] break -print 'my_scons.py: %s' % profile +print('my_scons.py: %s' % profile) """) test.run(arguments = 'run -f config foo.tar.gz') diff --git a/test/scons-time/run/option/scons.py b/test/scons-time/run/option/scons.py index 0bf883b..71d8ca2 100644 --- a/test/scons-time/run/option/scons.py +++ b/test/scons-time/run/option/scons.py @@ -43,7 +43,7 @@ for arg in sys.argv[1:]: if arg.startswith('--profile='): profile = arg[10:] break -print 'my_scons.py: %s' % profile +print('my_scons.py: %s' % profile) """) test.run(arguments = 'run --scons %s foo.tar.gz' % my_scons_py) -- cgit v0.12