summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-10-17 16:42:21 (GMT)
committerSteven Knight <knight@baldmt.com>2001-10-17 16:42:21 (GMT)
commit772ede31d7a5aed0c72943be9230313de687e0be (patch)
treef017114c2e9f7c7b8530f6216401a07b398d4b5f /test
parent3b884c9421bae33e2c7a204aacc5fdc2d9394423 (diff)
downloadSCons-772ede31d7a5aed0c72943be9230313de687e0be.zip
SCons-772ede31d7a5aed0c72943be9230313de687e0be.tar.gz
SCons-772ede31d7a5aed0c72943be9230313de687e0be.tar.bz2
Portability fixes for tests on Windows Nt.
Diffstat (limited to 'test')
-rw-r--r--test/CC.py9
-rw-r--r--test/Command.py17
-rw-r--r--test/Default.py19
-rw-r--r--test/Depends.py13
-rw-r--r--test/ENV.py8
-rw-r--r--test/LINK.py9
-rw-r--r--test/LINKFLAGS.py9
-rw-r--r--test/builderrors.py25
-rw-r--r--test/multiline.py15
-rw-r--r--test/option--.py12
-rw-r--r--test/option-c.py11
-rw-r--r--test/option-i.py11
-rw-r--r--test/option-j.py9
-rw-r--r--test/option-k.py11
-rw-r--r--test/option-n.py12
-rw-r--r--test/option-s.py10
-rw-r--r--test/up-to-date.py18
17 files changed, 130 insertions, 88 deletions
diff --git a/test/CC.py b/test/CC.py
index ce18047..5d2985f 100644
--- a/test/CC.py
+++ b/test/CC.py
@@ -25,24 +25,27 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write("ccwrapper.py",
"""import os
import string
import sys
-open('%s', 'w').write("ccwrapper.py\\n")
+open('%s', 'wb').write("ccwrapper.py\\n")
os.system(string.join(["cc"] + sys.argv[1:], " "))
""" % test.workpath('ccwrapper.out'))
test.write('SConstruct', """
foo = Environment()
-bar = Environment(CC = 'python ccwrapper.py')
+bar = Environment(CC = r'%s ccwrapper.py')
foo.Program(target = 'foo', source = 'foo.c')
bar.Program(target = 'bar', source = 'bar.c')
-""")
+""" % python)
test.write('foo.c', """
int
diff --git a/test/Command.py b/test/Command.py
index 5b592b9..c3080cb 100644
--- a/test/Command.py
+++ b/test/Command.py
@@ -24,14 +24,17 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
""")
@@ -39,14 +42,14 @@ file.close()
test.write('SConstruct', """
env = Environment()
env.Command(target = 'f1.out', source = 'f1.in',
- action = "python build.py $target $sources")
+ action = r'%s build.py $target $sources')
env.Command(target = 'f2.out', source = 'f2.in',
- action = "python build.py temp2 $sources\\npython build.py $target temp2")
+ action = r'%s' + " build.py temp2 $sources\\n" + r'%s' + " build.py $target temp2")
env.Command(target = 'f3.out', source = 'f3.in',
- action = ["python build.py temp3 $sources",
- "python build.py $target temp3"])
+ action = [r'%s build.py temp3 $sources',
+ r'%s build.py $target temp3'])
# Eventually, add ability to do execute Python code.
-""")
+""" % (python, python, python, python, python))
test.write('f1.in', "f1.in\n")
diff --git a/test/Default.py b/test/Default.py
index 515a9c0..9155660 100644
--- a/test/Default.py
+++ b/test/Default.py
@@ -25,43 +25,46 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.subdir('one', 'two', 'three')
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
""")
test.write(['one', 'SConstruct'], """
-B = Builder(name = 'B', action = "python ../build.py $target $sources")
+B = Builder(name = 'B', action = r'%s ../build.py $target $sources')
env = Environment(BUILDERS = [B])
env.B(target = 'foo.out', source = 'foo.in')
env.B(target = 'bar.out', source = 'bar.in')
Default('foo.out')
-""")
+""" % python)
test.write(['two', 'SConstruct'], """
-B = Builder(name = 'B', action = "python ../build.py $target $sources")
+B = Builder(name = 'B', action = r'%s ../build.py $target $sources')
env = Environment(BUILDERS = [B])
env.B(target = 'foo.out', source = 'foo.in')
env.B(target = 'bar.out', source = 'bar.in')
Default('foo.out', 'bar.out')
-""")
+""" % python)
test.write(['three', 'SConstruct'], """
-B = Builder(name = 'B', action = "python ../build.py $target $sources")
+B = Builder(name = 'B', action = r'%s ../build.py $target $sources')
env = Environment(BUILDERS = [B])
env.B(target = 'foo.out', source = 'foo.in')
env.B(target = 'bar.out', source = 'bar.in')
Default('foo.out bar.out')
-""")
+""" % python)
for dir in ['one', 'two', 'three']:
diff --git a/test/Depends.py b/test/Depends.py
index 61ebb0a..03033b1 100644
--- a/test/Depends.py
+++ b/test/Depends.py
@@ -24,25 +24,28 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.subdir('subdir')
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read() + open(sys.argv[3], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read() + open(sys.argv[3], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
""")
test.write('SConstruct', """
Foo = Builder(name = "Foo",
- action = "python build.py $target $sources subdir/foo.dep")
+ action = "%s build.py $target $sources subdir/foo.dep")
Bar = Builder(name = "Bar",
- action = "python build.py $target $sources subdir/bar.dep")
+ action = "%s build.py $target $sources subdir/bar.dep")
env = Environment(BUILDERS = [Foo, Bar])
env.Depends(target = ['f1.out', 'f2.out'], dependency = 'subdir/foo.dep')
env.Depends(target = 'f3.out', dependency = 'subdir/bar.dep')
@@ -50,7 +53,7 @@ env.Foo(target = 'f1.out', source = 'f1.in')
env.Foo(target = 'f2.out', source = 'f2.in')
env.Bar(target = 'f3.out', source = 'f3.in')
Conscript('subdir/SConscript')
-""")
+""" % (python, python))
test.write(['subdir', 'SConscript'], """
env.Depends(target = 'f4.out', dependency = 'bar.dep')
diff --git a/test/ENV.py b/test/ENV.py
index db51327..221e7f9 100644
--- a/test/ENV.py
+++ b/test/ENV.py
@@ -50,8 +50,8 @@ bin2.Bld(target = 'bin2.out', source = 'input')
test.write(bin1_build_py,
"""#!/usr/bin/env python
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write("bin1/build.py\\n")
file.write(contents)
file.close()
@@ -61,8 +61,8 @@ os.chmod(bin1_build_py, 0755)
test.write(bin2_build_py,
"""#!/usr/bin/env python
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write("bin2/build.py\\n")
file.write(contents)
file.close()
diff --git a/test/LINK.py b/test/LINK.py
index f2ac661..6b99976 100644
--- a/test/LINK.py
+++ b/test/LINK.py
@@ -25,24 +25,27 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write("ccwrapper.py",
"""import os
import string
import sys
-open('%s', 'w').write("ccwrapper.py\\n")
+open('%s', 'wb').write("ccwrapper.py\\n")
os.system(string.join(["cc"] + sys.argv[1:], " "))
""" % test.workpath('ccwrapper.out'))
test.write('SConstruct', """
foo = Environment()
-bar = Environment(LINK = 'python ccwrapper.py')
+bar = Environment(LINK = r'%s ccwrapper.py')
foo.Program(target = 'foo', source = 'foo.c')
bar.Program(target = 'bar', source = 'bar.c')
-""")
+""" % python)
test.write('foo.c', """
int
diff --git a/test/LINKFLAGS.py b/test/LINKFLAGS.py
index 06c1482..ff4ee88 100644
--- a/test/LINKFLAGS.py
+++ b/test/LINKFLAGS.py
@@ -25,24 +25,27 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write("ccwrapper.py",
"""import os
import string
import sys
-open('%s', 'w').write("ccwrapper.py\\n")
+open('%s', 'wb').write("ccwrapper.py\\n")
os.system(string.join(["cc"] + sys.argv[1:], " "))
""" % test.workpath('ccwrapper.out'))
test.write('SConstruct', """
foo = Environment()
-bar = Environment(LINK = '', LINKFLAGS = 'python ccwrapper.py')
+bar = Environment(LINK = '', LINKFLAGS = r'%s ccwrapper.py')
foo.Program(target = 'foo', source = 'foo.c')
bar.Program(target = 'bar', source = 'bar.c')
-""")
+""" % python)
test.write('foo.c', """
int
diff --git a/test/builderrors.py b/test/builderrors.py
index fad003a..769215a 100644
--- a/test/builderrors.py
+++ b/test/builderrors.py
@@ -25,8 +25,11 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.subdir('one', 'two', 'three')
@@ -35,21 +38,21 @@ test.write('build.py', r"""
import sys
exitval = int(sys.argv[1])
if exitval == 0:
- contents = open(sys.argv[3], 'r').read()
- file = open(sys.argv[2], 'w')
+ contents = open(sys.argv[3], 'rb').read()
+ file = open(sys.argv[2], 'wb')
file.write(contents)
file.close()
sys.exit(exitval)
""")
test.write(['one', 'SConstruct'], """
-B0 = Builder(name = 'B0', action = "python ../build.py 0 $target $sources")
-B1 = Builder(name = 'B1', action = "python ../build.py 1 $target $sources")
+B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
+B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
env = Environment(BUILDERS = [B0, B1])
env.B1(target = 'f1.out', source = 'f1.in')
env.B0(target = 'f2.out', source = 'f2.in')
env.B0(target = 'f3.out', source = 'f3.in')
-""")
+""" % (python, python))
test.write(['one', 'f1.in'], "one/f1.in\n")
test.write(['one', 'f2.in'], "one/f2.in\n")
@@ -63,13 +66,13 @@ test.fail_test(os.path.exists(test.workpath('f2.out')))
test.fail_test(os.path.exists(test.workpath('f3.out')))
test.write(['two', 'SConstruct'], """
-B0 = Builder(name = 'B0', action = "python ../build.py 0 $target $sources")
-B1 = Builder(name = 'B1', action = "python ../build.py 1 $target $sources")
+B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
+B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
env = Environment(BUILDERS = [B0, B1])
env.B0(target = 'f1.out', source = 'f1.in')
env.B1(target = 'f2.out', source = 'f2.in')
env.B0(target = 'f3.out', source = 'f3.in')
-""")
+""" % (python, python))
test.write(['two', 'f1.in'], "two/f1.in\n")
test.write(['two', 'f2.in'], "two/f2.in\n")
@@ -83,13 +86,13 @@ test.fail_test(os.path.exists(test.workpath('f2.out')))
test.fail_test(os.path.exists(test.workpath('f3.out')))
test.write(['three', 'SConstruct'], """
-B0 = Builder(name = 'B0', action = "python ../build.py 0 $target $sources")
-B1 = Builder(name = 'B1', action = "python ../build.py 1 $target $sources")
+B0 = Builder(name = 'B0', action = r'%s ../build.py 0 $target $sources')
+B1 = Builder(name = 'B1', action = r'%s ../build.py 1 $target $sources')
env = Environment(BUILDERS = [B0, B1])
env.B0(target = 'f1.out', source = 'f1.in')
env.B0(target = 'f2.out', source = 'f2.in')
env.B1(target = 'f3.out', source = 'f3.in')
-""")
+""" % (python, python))
test.write(['three', 'f1.in'], "three/f1.in\n")
test.write(['three', 'f2.in'], "three/f2.in\n")
diff --git a/test/multiline.py b/test/multiline.py
index dca0b00..7560d55 100644
--- a/test/multiline.py
+++ b/test/multiline.py
@@ -25,28 +25,31 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
sys.exit(0)
""")
test.write('SConstruct', """
-B1 = Builder(name = 'B1', action = ["python build.py .temp $sources",
- "python build.py $targets .temp"])
-B2 = Builder(name = 'B2', action = "python build.py .temp $sources\\npython build.py $targets .temp")
+B1 = Builder(name = 'B1', action = [r'%s build.py .temp $sources',
+ r'%s build.py $targets .temp'])
+B2 = Builder(name = 'B2', action = r'%s' + " build.py .temp $sources\\n" + r'%s' + " build.py $targets .temp")
env = Environment(BUILDERS = [B1, B2])
env.B1(target = 'foo1.out', source = 'foo1.in')
env.B2(target = 'foo2.out', source = 'foo2.in')
env.B1(target = 'foo3.out', source = 'foo3.in')
-""")
+""" % (python, python, python, python))
test.write('foo1.in', "foo1.in\n")
diff --git a/test/option--.py b/test/option--.py
index e9f427a..9fca2bd 100644
--- a/test/option--.py
+++ b/test/option--.py
@@ -24,29 +24,31 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import os.path
import string
import sys
+import TestSCons
+
+python = sys.executable
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
test.write('SConstruct', """
MyBuild = Builder(name = "MyBuild",
- action = "python build.py $targets")
+ action = r'%s build.py $targets')
env = Environment(BUILDERS = [MyBuild])
env.MyBuild(target = '-f1.out', source = 'f1.in')
env.MyBuild(target = '-f2.out', source = 'f2.in')
-""")
+""" % python)
-expect = "python build.py -f1.out\npython build.py -f2.out\n"
+expect = "%s build.py -f1.out\n%s build.py -f2.out\n" % (python, python)
test.run(arguments = '-- -f1.out -f2.out', stdout = expect)
test.fail_test(not os.path.exists(test.workpath('-f1.out')))
diff --git a/test/option-c.py b/test/option-c.py
index 76a60e9..0e41ffd 100644
--- a/test/option-c.py
+++ b/test/option-c.py
@@ -25,25 +25,28 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
""")
test.write('SConstruct', """
-B = Builder(name = 'B', action = "python build.py $targets $sources")
+B = Builder(name = 'B', action = r'%s build.py $targets $sources')
env = Environment(BUILDERS = [B])
env.B(target = 'foo1.out', source = 'foo1.in')
env.B(target = 'foo2.out', source = 'foo2.in')
env.B(target = 'foo3.out', source = 'foo3.in')
-""")
+""" % python)
test.write('foo1.in', "foo1.in\n")
diff --git a/test/option-i.py b/test/option-i.py
index 3301396..713655c 100644
--- a/test/option-i.py
+++ b/test/option-i.py
@@ -25,13 +25,16 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.write('succeed.py', r"""
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write("succeed.py: %s\n" % sys.argv[1])
file.close()
sys.exit(0)
@@ -43,14 +46,14 @@ sys.exit(1)
""")
test.write('SConstruct', """
-Succeed = Builder(name = "Succeed", action = "python succeed.py $targets")
-Fail = Builder(name = "Fail", action = "python fail.py $targets")
+Succeed = Builder(name = "Succeed", action = r'%s succeed.py $targets')
+Fail = Builder(name = "Fail", action = r'%s fail.py $targets')
env = Environment(BUILDERS = [Succeed, Fail])
env.Fail(target = 'aaa.1', source = 'aaa.in')
env.Succeed(target = 'aaa.out', source = 'aaa.1')
env.Fail(target = 'bbb.1', source = 'bbb.in')
env.Succeed(target = 'bbb.out', source = 'bbb.1')
-""")
+""" % (python, python))
test.run(arguments = 'aaa.1 aaa.out bbb.1 bbb.out',
stderr = 'scons: *** [aaa.1] Error 1\n')
diff --git a/test/option-j.py b/test/option-j.py
index 80cbcca..3eb0b12 100644
--- a/test/option-j.py
+++ b/test/option-j.py
@@ -24,10 +24,11 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import string
import sys
+import TestSCons
+python = sys.executable
try:
import threading
@@ -43,7 +44,7 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import time
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write(str(time.time()) + '\n')
time.sleep(1)
file.write(str(time.time()))
@@ -52,11 +53,11 @@ file.close()
test.write('SConstruct', """
MyBuild = Builder(name = "MyBuild",
- action = "python build.py $targets")
+ action = r'%s build.py $targets')
env = Environment(BUILDERS = [MyBuild])
env.MyBuild(target = 'f1', source = 'f1.in')
env.MyBuild(target = 'f2', source = 'f2.in')
-""")
+""" % python)
def RunTest(args, extra):
"""extra is used to make scons rebuild the output file"""
diff --git a/test/option-k.py b/test/option-k.py
index e8fead2..4034d83 100644
--- a/test/option-k.py
+++ b/test/option-k.py
@@ -25,15 +25,18 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
+import sys
import TestSCons
+python = sys.executable
+
test = TestSCons.TestSCons()
test.pass_test() #XXX Short-circuit until this is supported.
test.write('succeed.py', r"""
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write("succeed.py: %s\n" % sys.argv[1])
file.close()
sys.exit(0)
@@ -45,13 +48,13 @@ sys.exit(1)
""")
test.write('SConstruct', """
-Succeed = Builder(name = "Succeed", action = "python succeed.py $targets")
-Fail = Builder(name = "Fail", action = "python fail.py $targets")
+Succeed = Builder(name = "Succeed", action = r'%s succeed.py $targets')
+Fail = Builder(name = "Fail", action = r'%s fail.py $targets')
env = Environment(BUILDERS = [Succeed, Fail])
env.Fail(target = 'aaa.1', source = 'aaa.in')
env.Succeed(target = 'aaa.out', source = 'aaa.1')
env.Succeed(target = 'bbb.out', source = 'bbb.in')
-""")
+""" % (python, python))
test.run(arguments = '.')
diff --git a/test/option-n.py b/test/option-n.py
index cba2e96..0a11101 100644
--- a/test/option-n.py
+++ b/test/option-n.py
@@ -24,30 +24,32 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import os.path
import string
import sys
+import TestSCons
+
+python = sys.executable
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
test.write('SConstruct', """
MyBuild = Builder(name = "MyBuild",
- action = "python build.py $targets")
+ action = r'%s build.py $targets')
env = Environment(BUILDERS = [MyBuild])
env.MyBuild(target = 'f1.out', source = 'f1.in')
env.MyBuild(target = 'f2.out', source = 'f2.in')
-""")
+""" % python)
args = 'f1.out f2.out'
-expect = "python build.py f1.out\npython build.py f2.out\n"
+expect = "%s build.py f1.out\n%s build.py f2.out\n" % (python, python)
test.run(arguments = args, stdout = expect)
test.fail_test(not os.path.exists(test.workpath('f1.out')))
diff --git a/test/option-s.py b/test/option-s.py
index fe13fb7..6791786 100644
--- a/test/option-s.py
+++ b/test/option-s.py
@@ -24,27 +24,29 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import os.path
import string
import sys
+import TestSCons
+
+python = sys.executable
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'w')
+file = open(sys.argv[1], 'wb')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
test.write('SConstruct', """
MyBuild = Builder(name = "MyBuild",
- action = "python build.py $target")
+ action = r'%s build.py $target')
env = Environment(BUILDERS = [MyBuild])
env.MyBuild(target = 'f1.out', source = 'f1.in')
env.MyBuild(target = 'f2.out', source = 'f2.in')
-""")
+""" % python)
test.run(arguments = '-s f1.out f2.out', stdout = "")
test.fail_test(not os.path.exists(test.workpath('f1.out')))
diff --git a/test/up-to-date.py b/test/up-to-date.py
index 68df0d4..dd7d86a 100644
--- a/test/up-to-date.py
+++ b/test/up-to-date.py
@@ -24,29 +24,31 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import TestSCons
import os.path
import string
import sys
+import TestSCons
+
+python = sys.executable
test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'r').read()
-file = open(sys.argv[1], 'w')
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
file.write(contents)
file.close()
""")
test.write('SConstruct', """
-B = Builder(name = "B", action = "python build.py $targets $sources")
+B = Builder(name = "B", action = r'%s build.py $targets $sources')
env = Environment(BUILDERS = [B])
env.B(target = 'f1.out', source = 'f1.in')
env.B(target = 'f2.out', source = 'f2.in')
env.B(target = 'f3.out', source = 'f3.in')
env.B(target = 'f4.out', source = 'f4.in')
-""")
+""" % python)
test.write('f1.in', "f1.in\n")
test.write('f2.in', "f2.in\n")
@@ -57,10 +59,10 @@ test.run(arguments = 'f1.out f3.out')
test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout =
"""scons: "f1.out" is up to date.
-python build.py f2.out f2.in
+%s build.py f2.out f2.in
scons: "f3.out" is up to date.
-python build.py f4.out f4.in
-""")
+%s build.py f4.out f4.in
+""" % (python, python))
test.pass_test()