diff options
author | Greg Noel <GregNoel@tigris.org> | 2009-03-08 00:51:26 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2009-03-08 00:51:26 (GMT) |
commit | 7f380de2d31a8ca288bd8a44a51de8f2867830be (patch) | |
tree | beffc7420a3c8681158aeefa6b82628fa7121aca | |
parent | 4993b28ca2ef767ede531e21450f390683da6b66 (diff) | |
download | SCons-7f380de2d31a8ca288bd8a44a51de8f2867830be.zip SCons-7f380de2d31a8ca288bd8a44a51de8f2867830be.tar.gz SCons-7f380de2d31a8ca288bd8a44a51de8f2867830be.tar.bz2 |
Issue 2326, change execfile() to exec ... (FIXED)
-rw-r--r-- | QMTest/TestSCons_time.py | 3 | ||||
-rw-r--r-- | bench/bench.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Variables/VariablesTests.py | 3 | ||||
-rw-r--r-- | src/engine/SCons/Variables/__init__.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_optparse.py | 2 | ||||
-rw-r--r-- | src/script/scons-time.py | 10 | ||||
-rw-r--r-- | test/Deprecated/Options/Options.py | 2 | ||||
-rw-r--r-- | test/Deprecated/Options/chdir.py | 3 | ||||
-rw-r--r-- | test/SConscript/SConscriptChdir.py | 15 | ||||
-rw-r--r-- | test/SConscriptChdir.py | 15 | ||||
-rw-r--r-- | test/Variables/Variables.py | 2 | ||||
-rw-r--r-- | test/Variables/chdir.py | 3 |
12 files changed, 24 insertions, 39 deletions
diff --git a/QMTest/TestSCons_time.py b/QMTest/TestSCons_time.py index 0747393..f9a639e 100644 --- a/QMTest/TestSCons_time.py +++ b/QMTest/TestSCons_time.py @@ -46,7 +46,6 @@ scons_py = """\ #!/usr/bin/env python import os import sys -import string def write_args(fp, args): fp.write(args[0] + '\\n') for arg in args[1:]: @@ -59,7 +58,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(string.replace(open('SConstruct').read(), '\\r', '\\n')) +exec(open('SConstruct', 'rU').read()) """ aegis_py = """\ diff --git a/bench/bench.py b/bench/bench.py index d90d75a..ef60535 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -28,7 +28,6 @@ import getopt import sys import time import types -import string Usage = """\ Usage: bench.py OPTIONS file.py @@ -88,7 +87,7 @@ if len(args) != 1: sys.exit(1) -exec(string.replace(open(args[0]).read(), '\r', '\n')) +exec(open(args[0], 'rU').read()) try: diff --git a/src/engine/SCons/Variables/VariablesTests.py b/src/engine/SCons/Variables/VariablesTests.py index f1caff7..7f49692 100644 --- a/src/engine/SCons/Variables/VariablesTests.py +++ b/src/engine/SCons/Variables/VariablesTests.py @@ -23,7 +23,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import string import sys import unittest import TestSCons @@ -54,7 +53,7 @@ def check(key, value, env): def checkSave(file, expected): gdict = {} ldict = {} - exec string.replace(open(file).read(), '\r', '\n') in gdict, ldict + exec open(file, 'rU').read() in 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 3cc6694..805471a 100644 --- a/src/engine/SCons/Variables/__init__.py +++ b/src/engine/SCons/Variables/__init__.py @@ -166,7 +166,7 @@ class Variables: sys.path.insert(0, dir) try: values['__name__'] = filename - exec string.replace(open(filename).read(), '\r', '\n') in {}, values + exec open(filename, 'rU').read() in {}, values finally: if dir: del sys.path[0] diff --git a/src/engine/SCons/compat/_scons_optparse.py b/src/engine/SCons/compat/_scons_optparse.py index 23f2ad3..219adba 100644 --- a/src/engine/SCons/compat/_scons_optparse.py +++ b/src/engine/SCons/compat/_scons_optparse.py @@ -920,7 +920,7 @@ class Values: def read_file(self, filename, mode="careful"): vars = {} - exec string.replace(open(filename).read(), '\r', '\n') in vars + exec open(filename, 'rU').read() in vars self._update(vars, mode) def ensure_value(self, attr, value): diff --git a/src/script/scons-time.py b/src/script/scons-time.py index 019df31..6e18892 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -841,7 +841,7 @@ class SConsTimer: self.title = a if self.config_file: - exec string.replace(open(self.config_file).read(), '\r', '\n') in self.__dict__ + exec open(self.config_file, 'rU').read() in self.__dict__ if self.chdir: os.chdir(self.chdir) @@ -960,7 +960,7 @@ class SConsTimer: self.title = a if self.config_file: - HACK_for_exec(string.replace(open(self.config_file).read(), '\r', '\n'), self.__dict__) + HACK_for_exec(open(self.config_file, 'rU').read(), self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -1080,7 +1080,7 @@ class SConsTimer: object_name = args.pop(0) if self.config_file: - HACK_for_exec(string.replace(open(self.config_file).read(), '\r', '\n'), self.__dict__) + HACK_for_exec(open(self.config_file, 'rU').read(), self.__dict__) if self.chdir: os.chdir(self.chdir) @@ -1218,7 +1218,7 @@ class SConsTimer: sys.exit(1) if self.config_file: - exec string.replace(open(self.config_file).read(), '\r', '\n') in self.__dict__ + exec open(self.config_file, 'rU').read() in self.__dict__ if args: self.archive_list = args @@ -1458,7 +1458,7 @@ class SConsTimer: which = a if self.config_file: - HACK_for_exec(string.replace(open(self.config_file).read(), '\r', '\n'), self.__dict__) + HACK_for_exec(open(self.config_file, 'rU').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 f411478..d1c7114 100644 --- a/test/Deprecated/Options/Options.py +++ b/test/Deprecated/Options/Options.py @@ -241,7 +241,7 @@ opts.Save('options.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec string.replace(open(file).read(), '\r', '\n') in gdict, ldict + exec open(file, 'rU').read() in 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 547fe53..a8fb6c6 100644 --- a/test/Deprecated/Options/chdir.py +++ b/test/Deprecated/Options/chdir.py @@ -52,8 +52,7 @@ print "VARIABLE =", repr(env['VARIABLE']) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -import string -exec(string.replace(open('opts2.cfg').read(), '\\r', '\\n')) +exec(open('opts2.cfg', 'rU').read()) """) test.write(['bin', 'opts2.cfg'], """\ diff --git a/test/SConscript/SConscriptChdir.py b/test/SConscript/SConscriptChdir.py index 8169f08..4c55844 100644 --- a/test/SConscript/SConscriptChdir.py +++ b/test/SConscript/SConscriptChdir.py @@ -44,32 +44,27 @@ SConscript('dir5/SConscript') """) test.write(['dir1', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir2', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir3', 'SConscript'], """ import os.path name = os.path.join('dir3', 'create_test.py') -import string -exec(string.replace(open(name).read(), '\\r', '\\n')) +exec(open(name, 'rU').read()) """) test.write(['dir4', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir5', 'SConscript'], """ import os.path name = os.path.join('dir5', 'create_test.py') -import string -exec(string.replace(open(name).read(), '\\r', '\\n')) +exec(open(name, 'rU').read()) """) for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']: diff --git a/test/SConscriptChdir.py b/test/SConscriptChdir.py index 8169f08..4c55844 100644 --- a/test/SConscriptChdir.py +++ b/test/SConscriptChdir.py @@ -44,32 +44,27 @@ SConscript('dir5/SConscript') """) test.write(['dir1', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir2', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir3', 'SConscript'], """ import os.path name = os.path.join('dir3', 'create_test.py') -import string -exec(string.replace(open(name).read(), '\\r', '\\n')) +exec(open(name, 'rU').read()) """) test.write(['dir4', 'SConscript'], """ -import string -exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) +exec(open("create_test.py", 'rU').read()) """) test.write(['dir5', 'SConscript'], """ import os.path name = os.path.join('dir5', 'create_test.py') -import string -exec(string.replace(open(name).read(), '\\r', '\\n')) +exec(open(name, 'rU').read()) """) for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']: diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py index 0e6a152..a6ed74f 100644 --- a/test/Variables/Variables.py +++ b/test/Variables/Variables.py @@ -235,7 +235,7 @@ opts.Save('variables.saved', env) def checkSave(file, expected): gdict = {} ldict = {} - exec string.replace(open(file).read(), '\r', '\n') in gdict, ldict + exec open(file, 'rU').read() in 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 39eccb3..621e166 100644 --- a/test/Variables/chdir.py +++ b/test/Variables/chdir.py @@ -52,8 +52,7 @@ print "VARIABLE =", repr(env['VARIABLE']) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -import string -exec(string.replace(open('opts2.cfg').read(), '\\r', '\\n')) +exec(open('opts2.cfg', 'rU').read()) """) test.write(['bin', 'opts2.cfg'], """\ |