From e1aa8d2b2d64eb147cedc24016c38f209d9d397f Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Sat, 11 Mar 2017 03:51:29 -0800 Subject: Remove 'U' flag to open() which is deprecated. --- QMTest/TestSCons_time.py | 2 +- bench/bench.py | 2 +- bin/update-release-info.py | 2 +- src/engine/SCons/Variables/VariablesTests.py | 2 +- src/engine/SCons/Variables/__init__.py | 2 +- src/script/scons-time.py | 6 +++--- test/Deprecated/Options/Options.py | 2 +- test/Deprecated/Options/chdir.py | 2 +- test/SConscript/SConscriptChdir.py | 10 +++++----- test/Variables/Variables.py | 2 +- test/Variables/chdir.py | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/QMTest/TestSCons_time.py b/QMTest/TestSCons_time.py index a9212f7..bc116ec 100644 --- a/QMTest/TestSCons_time.py +++ b/QMTest/TestSCons_time.py @@ -49,7 +49,7 @@ for arg in sys.argv[1:]: write_args(profile, sys.argv) break sys.stdout.write('SCONS_LIB_DIR = ' + os.environ['SCONS_LIB_DIR'] + '\\n') -exec(open('SConstruct', 'rU').read()) +exec(open('SConstruct', 'r').read()) """ aegis_py = """\ diff --git a/bench/bench.py b/bench/bench.py index cfdac2d..3f7dbc6 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -88,7 +88,7 @@ if len(args) != 1: sys.exit(1) -exec(open(args[0], 'rU').read()) +exec(open(args[0], 'r').read()) try: diff --git a/bin/update-release-info.py b/bin/update-release-info.py index 49f2788..81e0df5 100644 --- a/bin/update-release-info.py +++ b/bin/update-release-info.py @@ -152,7 +152,7 @@ class UpdateFile(object): ''' if orig is None: orig = file try: - self.content = open(orig, 'rU').read() + self.content = open(orig, 'r').read() except IOError: # Couldn't open file; don't try to write anything in __del__ self.file = None diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py index 69f1e01..7ee66ca 100644 --- a/src/engine/SCons/Variables/VariablesTests.py +++ b/src/engine/SCons/Variables/VariablesTests.py @@ -65,7 +65,7 @@ def check(key, value, env): def checkSave(file, expected): gdict = {} ldict = {} - exec(open(file, 'rU').read(), gdict, ldict) + exec(open(file, 'r').read(), gdict, ldict) assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) class VariablesTestCase(unittest.TestCase): diff --git a/src/engine/SCons/Variables/__init__.py b/src/engine/SCons/Variables/__init__.py index ce3541c..54b97a4 100644 --- a/src/engine/SCons/Variables/__init__.py +++ b/src/engine/SCons/Variables/__init__.py @@ -175,7 +175,7 @@ class Variables(object): sys.path.insert(0, dir) try: values['__name__'] = filename - exec(open(filename, 'rU').read(), {}, values) + exec(open(filename, 'r').read(), {}, values) finally: if dir: del sys.path[0] diff --git a/src/script/scons-time.py b/src/script/scons-time.py index c788e50..f12280c 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -814,7 +814,7 @@ class SConsTimer(object): self.title = a if self.config_file: - exec(open(self.config_file, 'rU').read(), self.__dict__) + exec(open(self.config_file, 'r').read(), self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -933,7 +933,7 @@ class SConsTimer(object): self.title = a if self.config_file: - HACK_for_exec(open(self.config_file, 'rU').read(), self.__dict__) + HACK_for_exec(open(self.config_file, 'r').read(), self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -1053,7 +1053,7 @@ class SConsTimer(object): object_name = args.pop(0) if self.config_file: - HACK_for_exec(open(self.config_file, 'rU').read(), self.__dict__) + HACK_for_exec(open(self.config_file, 'r').read(), self.__dict__) if self.chdir: os.chdir(self.chdir) diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py index e435b9e..6c021f0 100644 --- a/test/Deprecated/Options/Options.py +++ b/test/Deprecated/Options/Options.py @@ -237,7 +237,7 @@ opts.Save('options.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec(open(file, 'rU').read(), gdict, ldict) + exec(open(file, 'r').read(), gdict, ldict) assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) # First test with no command line options diff --git a/test/Deprecated/Options/chdir.py b/test/Deprecated/Options/chdir.py index 977a351..ed0aab1 100644 --- a/test/Deprecated/Options/chdir.py +++ b/test/Deprecated/Options/chdir.py @@ -52,7 +52,7 @@ print("VARIABLE =", repr(env['VARIABLE'])) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -exec(open('opts2.cfg', 'rU').read()) +exec(open('opts2.cfg', 'r').read()) """) test.write(['bin', 'opts2.cfg'], """\ diff --git a/test/SConscript/SConscriptChdir.py b/test/SConscript/SConscriptChdir.py index 4c55844..211d55b 100644 --- a/test/SConscript/SConscriptChdir.py +++ b/test/SConscript/SConscriptChdir.py @@ -44,27 +44,27 @@ SConscript('dir5/SConscript') """) test.write(['dir1', 'SConscript'], """ -exec(open("create_test.py", 'rU').read()) +exec(open("create_test.py", 'r').read()) """) test.write(['dir2', 'SConscript'], """ -exec(open("create_test.py", 'rU').read()) +exec(open("create_test.py", 'r').read()) """) test.write(['dir3', 'SConscript'], """ import os.path name = os.path.join('dir3', 'create_test.py') -exec(open(name, 'rU').read()) +exec(open(name, 'r').read()) """) test.write(['dir4', 'SConscript'], """ -exec(open("create_test.py", 'rU').read()) +exec(open("create_test.py", 'r').read()) """) test.write(['dir5', 'SConscript'], """ import os.path name = os.path.join('dir5', 'create_test.py') -exec(open(name, 'rU').read()) +exec(open(name, 'r').read()) """) for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']: diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py index 1c60635..d08594d 100644 --- a/test/Variables/Variables.py +++ b/test/Variables/Variables.py @@ -231,7 +231,7 @@ opts.Save('variables.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec(open(file, 'rU').read(), gdict, ldict) + exec(open(file, 'r').read(), gdict, ldict) assert expected == ldict, "%s\n...not equal to...\n%s" % (expected, ldict) # First test with no command line variables diff --git a/test/Variables/chdir.py b/test/Variables/chdir.py index 2d097d5..0e9abaa 100644 --- a/test/Variables/chdir.py +++ b/test/Variables/chdir.py @@ -52,7 +52,7 @@ print("VARIABLE =", repr(env['VARIABLE'])) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -exec(open('opts2.cfg', 'rU').read()) +exec(open('opts2.cfg', 'r').read()) """) test.write(['bin', 'opts2.cfg'], """\ -- cgit v0.12