From f80aee089f44d50877e65f049424df212c867ff3 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 3 Apr 2017 17:49:56 -0400 Subject: py2/3 mode=r/w fixes --- QMTest/TestSCons.py | 8 ++++---- test/QT/QTFLAGS.py | 2 +- test/QT/source-from-ui.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index c35a2b3..b6366a6 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -871,12 +871,12 @@ output = None impl = 0 opt_string = '' for opt, arg in cmd_opts: - if opt == '-o': output = open(arg, 'wb') + if opt == '-o': output = open(arg, 'w') elif opt == '-i': impl = 1 else: opt_string = opt_string + ' ' + opt output.write("/* mymoc.py%s */\\n" % opt_string) for a in args: - contents = open(a, 'rb').read() + contents = open(a, 'r').read() a = a.replace('\\\\', '\\\\\\\\') subst = r'{ my_qt_symbol( "' + a + '\\\\n" ); }' if impl: @@ -897,7 +897,7 @@ source = None opt_string = '' for arg in sys.argv[1:]: if output_arg: - output = open(arg, 'wb') + output = open(arg, 'w') output_arg = 0 elif impl_arg: impl = arg @@ -911,7 +911,7 @@ for arg in sys.argv[1:]: else: if source: sys.exit(1) - source = open(arg, 'rb') + source = open(arg, 'r') sourceFile = arg output.write("/* myuic.py%s */\\n" % opt_string) if impl: diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py index f6aa00f..8d266ad 100644 --- a/test/QT/QTFLAGS.py +++ b/test/QT/QTFLAGS.py @@ -148,7 +148,7 @@ test.must_exist(['work1', 'mmmmocFromH.cxx'], def _flagTest(test,fileToContentsStart): for f,c in fileToContentsStart.items(): - if test.read(test.workpath('work1', f)).find(c) != 0: + if test.read(test.workpath('work1', f), mode='r').find(c) != 0: return 1 return 0 diff --git a/test/QT/source-from-ui.py b/test/QT/source-from-ui.py index b8be72e..7922717 100644 --- a/test/QT/source-from-ui.py +++ b/test/QT/source-from-ui.py @@ -124,7 +124,7 @@ test.must_not_exist(test.workpath(moc)) test.must_not_exist(test.workpath(cpp)) test.must_not_exist(test.workpath(h)) -cppContents = test.read(test.workpath('build', cpp)) +cppContents = test.read(test.workpath('build', cpp), mode='r') test.fail_test(cppContents.find('#include "aaa.ui.h"') == -1) test.run(arguments = "variant_dir=1 chdir=1 " + -- cgit v0.12