#!/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:]:
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 = """\
import sys
import time
import types
-import string
Usage = """\
Usage: bench.py OPTIONS file.py
sys.exit(1)
-exec(string.replace(open(args[0]).read(), '\r', '\n'))
+exec(open(args[0], 'rU').read())
try:
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
import sys
import unittest
import TestSCons
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):
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]
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):
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)
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)
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)
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
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)
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
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'], """\
""")
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']:
""")
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']:
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
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'], """\