diff options
| author | Greg Noel <GregNoel@tigris.org> | 2009-03-02 03:19:29 (GMT) |
|---|---|---|
| committer | Greg Noel <GregNoel@tigris.org> | 2009-03-02 03:19:29 (GMT) |
| commit | c1396537e5cae88e6357931dc6efe4074cf54ced (patch) | |
| tree | cbd8a625268ec290a2d2e03bbad4a94de8678919 /test | |
| parent | 22364c2fd6117fefb82e0addb7e9efca027e5c2e (diff) | |
| download | SCons-c1396537e5cae88e6357931dc6efe4074cf54ced.zip SCons-c1396537e5cae88e6357931dc6efe4074cf54ced.tar.gz SCons-c1396537e5cae88e6357931dc6efe4074cf54ced.tar.bz2 | |
replace execfile() by equivalent exec statement
Diffstat (limited to 'test')
| -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 |
6 files changed, 26 insertions, 14 deletions
diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py index d04ad44..f411478 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 = {} - execfile(file, gdict, ldict) + exec string.replace(open(file).read(), '\r', '\n') 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 0db8223..547fe53 100644 --- a/test/Deprecated/Options/chdir.py +++ b/test/Deprecated/Options/chdir.py @@ -52,7 +52,8 @@ print "VARIABLE =", repr(env['VARIABLE']) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -execfile('opts2.cfg') +import string +exec(string.replace(open('opts2.cfg').read(), '\\r', '\\n')) """) test.write(['bin', 'opts2.cfg'], """\ diff --git a/test/SConscript/SConscriptChdir.py b/test/SConscript/SConscriptChdir.py index 99810e3..8169f08 100644 --- a/test/SConscript/SConscriptChdir.py +++ b/test/SConscript/SConscriptChdir.py @@ -44,27 +44,32 @@ SConscript('dir5/SConscript') """) test.write(['dir1', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir2', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir3', 'SConscript'], """ import os.path name = os.path.join('dir3', 'create_test.py') -execfile(name) +import string +exec(string.replace(open(name).read(), '\\r', '\\n')) """) test.write(['dir4', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir5', 'SConscript'], """ import os.path name = os.path.join('dir5', 'create_test.py') -execfile(name) +import string +exec(string.replace(open(name).read(), '\\r', '\\n')) """) for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']: diff --git a/test/SConscriptChdir.py b/test/SConscriptChdir.py index 99810e3..8169f08 100644 --- a/test/SConscriptChdir.py +++ b/test/SConscriptChdir.py @@ -44,27 +44,32 @@ SConscript('dir5/SConscript') """) test.write(['dir1', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir2', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir3', 'SConscript'], """ import os.path name = os.path.join('dir3', 'create_test.py') -execfile(name) +import string +exec(string.replace(open(name).read(), '\\r', '\\n')) """) test.write(['dir4', 'SConscript'], """ -execfile("create_test.py") +import string +exec(string.replace(open("create_test.py").read(), '\\r', '\\n')) """) test.write(['dir5', 'SConscript'], """ import os.path name = os.path.join('dir5', 'create_test.py') -execfile(name) +import string +exec(string.replace(open(name).read(), '\\r', '\\n')) """) for dir in ['dir1', 'dir2', 'dir3','dir4', 'dir5']: diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py index eaac22d..0e6a152 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 = {} - execfile(file, gdict, ldict) + exec string.replace(open(file).read(), '\r', '\n') 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 711957c..39eccb3 100644 --- a/test/Variables/chdir.py +++ b/test/Variables/chdir.py @@ -52,7 +52,8 @@ print "VARIABLE =", repr(env['VARIABLE']) test.write(['bin', 'opts.cfg'], """\ import os os.chdir(os.path.split(__name__)[0]) -execfile('opts2.cfg') +import string +exec(string.replace(open('opts2.cfg').read(), '\\r', '\\n')) """) test.write(['bin', 'opts2.cfg'], """\ |
