summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-11-24 23:15:01 (GMT)
committerSteven Knight <knight@baldmt.com>2001-11-24 23:15:01 (GMT)
commit378373defaf150feb90cd54d13626516c6dbe1b4 (patch)
treefc9783004f1cae3c3558846d6f9a1c589e104a3e
parent139a0052dc0bff059dc9b8cf1739396304e7c129 (diff)
downloadSCons-378373defaf150feb90cd54d13626516c6dbe1b4.zip
SCons-378373defaf150feb90cd54d13626516c6dbe1b4.tar.gz
SCons-378373defaf150feb90cd54d13626516c6dbe1b4.tar.bz2
More NT portability fixes.
-rw-r--r--runtest.py19
-rw-r--r--src/engine/SCons/Builder.py4
-rw-r--r--src/engine/SCons/Defaults.py19
-rw-r--r--src/engine/SCons/Environment.py3
-rw-r--r--src/engine/SCons/Node/FS.py39
-rw-r--r--src/engine/SCons/Node/FSTests.py79
-rw-r--r--src/engine/SCons/Taskmaster.py6
-rw-r--r--test/CC.py4
-rw-r--r--test/CCFLAGS.py36
-rw-r--r--test/Default.py4
-rw-r--r--test/Library.py18
-rw-r--r--test/Object.py12
-rw-r--r--test/Program.py26
-rw-r--r--test/nonwritable-sconsign.py2
-rw-r--r--test/subdir.py20
15 files changed, 168 insertions, 123 deletions
diff --git a/runtest.py b/runtest.py
index 108db73..dd82b0e 100644
--- a/runtest.py
+++ b/runtest.py
@@ -56,6 +56,11 @@ printcmd = 1
version = None
testver = 1
+if sys.platform == 'win32':
+ lib_dir = os.path.join(sys.exec_prefix, "lib")
+else:
+ lib_dir = os.path.join(sys.exec_prefix, "lib", "python" + sys.version[0:3])
+
opts, tests = getopt.getopt(sys.argv[1:], "12ab:dqv:",
['all','build=','debug','quiet','version='])
@@ -64,11 +69,7 @@ for o, a in opts:
elif o == '-2': testver = 2
elif o == '-a' or o == '--all': all = 1
elif o == '-b' or o == '--build': build = a
- elif o == '-d' or o == '--debug': debug = os.path.join(
- sys.exec_prefix,
- "lib",
- "python" + sys.version[0:3],
- "pdb.py")
+ elif o == '-d' or o == '--debug': debug = os.path.join(lib_dir, "pdb.py")
elif o == '-q' or o == '--quiet': printcmd = 0
elif o == '-v' or o == '--version': version = a
@@ -143,4 +144,12 @@ for path in tests:
if os.system(cmd):
fail.append(path)
+if fail and len(tests) != 1:
+ if len(fail) == 1:
+ str = "test"
+ else:
+ str = "%d tests" % len(fail)
+ print "\nFailed the following %s:" % str
+ print "\t", string.join(fail, "\n\t")
+
sys.exit(len(fail))
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index fc372fa..e36f332 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -85,8 +85,8 @@ elif os.name == 'nt':
exts = string.split(exts, os.pathsep)
pairs = []
for dir in path:
- for e in [None] + exts:
- pairs.append(dir, e)
+ for e in exts:
+ pairs.append((dir, e))
for dir, ext in pairs:
f = os.path.join(dir, cmd)
if not ext is None:
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 0bc82eb..be750e4 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -102,6 +102,10 @@ if os.name == 'posix':
elif os.name == 'nt':
+ MVSdir = r'C:\Program Files\Microsoft Visual Studio'
+ MVSVCdir = r'%s\VC98' % MVSdir
+ MVSCommondir = r'%s\Common' % MVSdir
+
ConstructionEnvironment = {
'CC' : 'cl',
'CCFLAGS' : '/nologo',
@@ -111,10 +115,10 @@ elif os.name == 'nt':
'CXXCOM' : '$CXX $CXXFLAGS $_INCFLAGS /c $SOURCES /Fo$TARGET',
'LINK' : 'link',
'LINKFLAGS' : '',
- 'LINKCOM' : '$LINK $LINKFLAGS /out:$TARGET $_LIBDIRFLAGS $_LIBFLAGS $SOURCES',
+ 'LINKCOM' : '$LINK $LINKFLAGS /OUT:$TARGET $_LIBDIRFLAGS $_LIBFLAGS $SOURCES',
'AR' : 'lib',
'ARFLAGS' : '/nologo',
- 'ARCOM' : '$AR $ARFLAGS /out:$TARGET $SOURCES',
+ 'ARCOM' : '$AR $ARFLAGS /OUT:$TARGET $SOURCES',
'BUILDERS' : [Object, Program, Library],
'SCANNERS' : [CScan],
'OBJPREFIX' : '',
@@ -123,14 +127,21 @@ elif os.name == 'nt':
'PROGSUFFIX' : '.exe',
'LIBPREFIX' : '',
'LIBSUFFIX' : '.lib',
- 'LIBDIRPREFIX' : '/L',
+ 'LIBDIRPREFIX' : '/LIBPATH',
'LIBDIRSUFFIX' : '',
'LIBLINKPREFIX' : '',
'LIBLINKSUFFIX' : '$LIBSUFFIX',
'INCPREFIX' : '/I',
'INCSUFFIX' : '',
'ENV' : {
- 'PATH' : r'C:\Python20;C:\WINNT\system32;C:\WINNT;C:\Program Files\Microsoft Visual Studio\VC98\Bin\;',
+ 'INCLUDE' : r'%s\atl\include;%s\mfc\include;%s\include'
+ % (MVSVCdir, MVSVCdir, MVSVCdir),
+ 'LIB' : r'%s\mvc\lib;%s\lib'
+ % (MVSVCdir, MVSVCdir),
+ 'MSDEVDIR' : r'%s\MSDev98' % MVSCommondir,
+ 'PATH' : r'C:\Python20;C:\WINNT\system32;C:\WINNT;%s\Tools\WinNT;%s\MSDev98\Bin;%s\Tools;%s\Bin;'
+ % (MVSCommondir, MVSCommondir,
+ MVSCommondir, MVSVCdir),
'PATHEXT' : '.COM;.EXE;.BAT;.CMD',
},
}
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 812eda7..f85f723 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -32,6 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import copy
+import os.path
import re
import types
import SCons.Util
@@ -164,7 +165,7 @@ class Environment:
suffix =''
self._dict[strVarAuto] = map(lambda x, suff=suffix, pref=prefix: \
- pref + str(x) + suff,
+ pref + os.path.normpath(str(x)) + suff,
src_var)
def __cmp__(self, other):
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 75f7c5c..67a5ae7 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -97,13 +97,12 @@ class PathDict(UserDict):
def __delitem__(self, key):
del(self.data[PathName(key)])
- if not hasattr(UserDict, 'setdefault'):
- def setdefault(self, key, value):
- try:
- return self.data[PathName(key)]
- except KeyError:
- self.data[PathName(key)] = value
- return value
+ def setdefault(self, key, value):
+ try:
+ return self.data[PathName(key)]
+ except KeyError:
+ self.data[PathName(key)] = value
+ return value
class FS:
def __init__(self, path = None):
@@ -120,7 +119,7 @@ class FS:
self.Root = PathDict()
self.Top = self.__doLookup(Dir, path)
self.Top.path = '.'
- self.Top.path_ = './'
+ self.Top.path_ = os.path.join('.', '')
self.cwd = self.Top
def __doLookup(self, fsclass, name, directory=None):
@@ -147,11 +146,16 @@ class FS:
# None, raise an exception.
drive, tail = os.path.splitdrive(head)
- if sys.platform is 'win32' and not drive:
- if not directory:
- raise OSError, 'No drive letter supplied for absolute path.'
- return directory.root()
- return self.Root.setdefault(drive, Dir(tail))
+ #if sys.platform is 'win32' and not drive:
+ # if not directory:
+ # raise OSError, 'No drive letter supplied for absolute path.'
+ # return directory.root()
+ dir = Dir(tail)
+ dir.path = drive + dir.path
+ dir.path_ = drive + dir.path_
+ dir.abspath = drive + dir.abspath
+ dir.abspath_ = drive + dir.abspath_
+ return self.Root.setdefault(drive, dir)
if head:
# Recursively look up our parent directories.
directory = self.__doLookup(Dir, head, directory)
@@ -181,7 +185,7 @@ class FS:
usually in preparation for a call to doLookup().
If the path name is prepended with a '#', then it is unconditionally
- interpreted as replative to the top-level directory of this FS.
+ interpreted as relative to the top-level directory of this FS.
If directory is None, and name is a relative path,
then the same applies.
@@ -256,7 +260,7 @@ class Entry(SCons.Node.Node):
if directory:
self.abspath = os.path.join(directory.abspath, name)
if str(directory.path) == '.':
- self.path = os.path.join(name)
+ self.path = name
else:
self.path = os.path.join(directory.path, name)
else:
@@ -335,9 +339,8 @@ class Dir(Entry):
def children(self):
#XXX --random: randomize "dependencies?"
- kids = map(lambda x, s=self: s.entries[x],
- filter(lambda k: k != '.' and k != '..',
- self.entries.keys()))
+ keys = filter(lambda k: k != '.' and k != '..', self.entries.keys())
+ kids = map(lambda x, s=self: s.entries[x], keys)
def c(one, two):
if one.abspath < two.abspath:
return -1
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index fe35d76..4992099 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -92,22 +92,19 @@ class FSTestCase(unittest.TestCase):
def Dir_test(lpath, path_, abspath_, up_path_, fileSys=fs, s=sep):
dir = fileSys.Dir(string.replace(lpath, '/', s))
+ if os.sep != '/':
+ path_ = string.replace(path_, '/', os.sep)
+ abspath_ = string.replace(abspath_, '/', os.sep)
+ up_path_ = string.replace(up_path_, '/', os.sep)
+
def strip_slash(p):
- if p[-1] == '/' and len(p) > 1:
+ if p[-1] == os.sep and len(p) > 1:
p = p[:-1]
return p
path = strip_slash(path_)
abspath = strip_slash(abspath_)
up_path = strip_slash(up_path_)
- name = string.split(abspath, '/')[-1]
-
- if os.sep != '/':
- path = string.replace(path, '/', os.sep)
- path_ = string.replace(path_, '/', os.sep)
- abspath = string.replace(abspath, '/', os.sep)
- abspath_ = string.replace(abspath_, '/', os.sep)
- up_path = string.replace(up_path, '/', os.sep)
- up_path_ = string.replace(up_path_, '/', os.sep)
+ name = string.split(abspath, os.sep)[-1]
assert dir.name == name, \
"dir.name %s != expected name %s" % \
@@ -211,53 +208,57 @@ class FSTestCase(unittest.TestCase):
f1.build()
assert built_it
+ def match(path, expect):
+ expect = string.replace(expect, '/', os.sep)
+ assert path == expect, "path %s != expected %s" % (path, expect)
+
e1 = fs.Entry("d1")
assert e1.__class__.__name__ == 'Dir'
- assert e1.path == "d1", e1.path
- assert e1.path_ == "d1/", e1.path_
- assert e1.dir.path == ".", e1.dir.path
+ match(e1.path, "d1")
+ match(e1.path_, "d1/")
+ match(e1.dir.path, ".")
e2 = fs.Entry("d1/f1")
assert e2.__class__.__name__ == 'File'
- assert e2.path == "d1/f1", e2.path
- assert e2.path_ == "d1/f1", e2.path_
- assert e2.dir.path == "d1", e2.dir.path
+ match(e2.path, "d1/f1")
+ match(e2.path_, "d1/f1")
+ match(e2.dir.path, "d1")
e3 = fs.Entry("e3")
assert e3.__class__.__name__ == 'Entry'
- assert e3.path == "e3", e3.path
- assert e3.path_ == "e3", e3.path_
- assert e3.dir.path == ".", e3.dir.path
+ match(e3.path, "e3")
+ match(e3.path_, "e3")
+ match(e3.dir.path, ".")
e4 = fs.Entry("d1/e4")
assert e4.__class__.__name__ == 'Entry'
- assert e4.path == "d1/e4", e4.path
- assert e4.path_ == "d1/e4", e4.path_
- assert e4.dir.path == "d1", e4.dir.path
+ match(e4.path, "d1/e4")
+ match(e4.path_, "d1/e4")
+ match(e4.dir.path, "d1")
e5 = fs.Entry("e3/e5")
assert e3.__class__.__name__ == 'Dir'
- assert e3.path == "e3", e3.path
- assert e3.path_ == "e3/", e3.path_
- assert e3.dir.path == ".", e3.dir.path
+ match(e3.path, "e3")
+ match(e3.path_, "e3/")
+ match(e3.dir.path, ".")
assert e5.__class__.__name__ == 'Entry'
- assert e5.path == "e3/e5", e5.path
- assert e5.path_ == "e3/e5", e5.path_
- assert e5.dir.path == "e3", e5.dir.path
+ match(e5.path, "e3/e5")
+ match(e5.path_, "e3/e5")
+ match(e5.dir.path, "e3")
e6 = fs.Dir("d1/e4")
assert e6 is e4
assert e4.__class__.__name__ == 'Dir'
- assert e4.path == "d1/e4", e4.path
- assert e4.path_ == "d1/e4/", e4.path_
- assert e4.dir.path == "d1", e4.dir.path
+ match(e4.path, "d1/e4")
+ match(e4.path_, "d1/e4/")
+ match(e4.dir.path, "d1")
e7 = fs.File("e3/e5")
assert e7 is e5
assert e5.__class__.__name__ == 'File'
- assert e5.path == "e3/e5", e5.path
- assert e5.path_ == "e3/e5", e5.path_
- assert e5.dir.path == "e3", e5.dir.path
+ match(e5.path, "e3/e5")
+ match(e5.path_, "e3/e5")
+ match(e5.dir.path, "e3")
e8 = fs.Entry("e8")
assert e8.get_bsig() is None, e8.get_bsig()
@@ -285,21 +286,21 @@ class FSTestCase(unittest.TestCase):
fs.chdir(fs.Dir('subdir'))
f11 = fs.File("f11")
- assert f11.path == "subdir/f11"
+ match(f11.path, "subdir/f11")
d12 = fs.Dir("d12")
- assert d12.path_ == "subdir/d12/"
+ match(d12.path_, "subdir/d12/")
e13 = fs.Entry("subdir/e13")
- assert e13.path == "subdir/subdir/e13"
+ match(e13.path, "subdir/subdir/e13")
# Test scanning
f1.scanner = Scanner()
f1.scan()
- assert f1.depends[0].path_ == "d1/f1"
+ assert f1.depends[0].path_ == os.path.join("d1", "f1")
f1.scanner = None
f1.depends = []
f1.scanned = 0
f1.scan()
- assert f1.depends[0].path_ == "d1/f1"
+ assert f1.depends[0].path_ == os.path.join("d1", "f1")
# Test building a file whose directory is not there yet...
f1 = fs.File(test.workpath("foo/bar/baz/ack"))
diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py
index 2184589..e7dcfc0 100644
--- a/src/engine/SCons/Taskmaster.py
+++ b/src/engine/SCons/Taskmaster.py
@@ -140,7 +140,11 @@ class Taskmaster:
"""
def __init__(self, targets=[], tasker=Task, calc=Calc()):
- self.walkers = map(SCons.Node.Walker, targets)
+ def out_of_date(node):
+ return filter(lambda x: x.get_state() != SCons.Node.up_to_date,
+ node.children())
+ self.walkers = map(lambda x, f=out_of_date: SCons.Node.Walker(x, f),
+ targets)
self.tasker = tasker
self.calc = calc
self.ready = []
diff --git a/test/CC.py b/test/CC.py
index 5d2985f..70e6da5 100644
--- a/test/CC.py
+++ b/test/CC.py
@@ -47,7 +47,7 @@ foo.Program(target = 'foo', source = 'foo.c')
bar.Program(target = 'bar', source = 'bar.c')
""" % python)
-test.write('foo.c', """
+test.write('foo.c', r"""
int
main(int argc, char *argv[])
{
@@ -57,7 +57,7 @@ main(int argc, char *argv[])
}
""")
-test.write('bar.c', """
+test.write('bar.c', r"""
int
main(int argc, char *argv[])
{
diff --git a/test/CCFLAGS.py b/test/CCFLAGS.py
index 8b0e5a8..3c9e716 100644
--- a/test/CCFLAGS.py
+++ b/test/CCFLAGS.py
@@ -24,20 +24,30 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import TestSCons
+if sys.platform == 'win32':
+ _obj = '.obj'
+ fooflags = '/nologo -DFOO'
+ barflags = '/nologo -DBAR'
+else:
+ _obj = '.o'
+ fooflags = '-DFOO'
+ barflags = '-DBAR'
+
test = TestSCons.TestSCons()
test.write('SConstruct', """
-foo = Environment(CCFLAGS = '-DFOO')
-bar = Environment(CCFLAGS = '-DBAR')
-foo.Object(target = 'foo.o', source = 'prog.c')
-bar.Object(target = 'bar.o', source = 'prog.c')
-foo.Program(target = 'foo', source = 'foo.o')
-bar.Program(target = 'bar', source = 'bar.o')
-""")
+foo = Environment(CCFLAGS = '%s')
+bar = Environment(CCFLAGS = '%s')
+foo.Object(target = 'foo%s', source = 'prog.c')
+bar.Object(target = 'bar%s', source = 'prog.c')
+foo.Program(target = 'foo', source = 'foo%s')
+bar.Program(target = 'bar', source = 'bar%s')
+""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
-test.write('prog.c', """
+test.write('prog.c', r"""
int
main(int argc, char *argv[])
{
@@ -60,11 +70,11 @@ test.run(program = test.workpath('bar'), stdout = "prog.c: BAR\n")
test.write('SConstruct', """
bar = Environment(CCFLAGS = '-DBAR')
-bar.Object(target = 'foo.o', source = 'prog.c')
-bar.Object(target = 'bar.o', source = 'prog.c')
-bar.Program(target = 'foo', source = 'foo.o')
-bar.Program(target = 'bar', source = 'bar.o')
-""")
+bar.Object(target = 'foo%s', source = 'prog.c')
+bar.Object(target = 'bar%s', source = 'prog.c')
+bar.Program(target = 'foo', source = 'foo%s')
+bar.Program(target = 'bar', source = 'bar%s')
+""" % (_obj, _obj, _obj, _obj))
test.run(arguments = '.')
diff --git a/test/Default.py b/test/Default.py
index 93e6be6..ceab745 100644
--- a/test/Default.py
+++ b/test/Default.py
@@ -71,9 +71,9 @@ for dir in ['one', 'two', 'three']:
foo_in = os.path.join(dir, 'foo.in')
bar_in = os.path.join(dir, 'bar.in')
- test.write(foo_in, foo_in + "\n");
+ test.write(foo_in, dir + "/foo.in\n");
- test.write(bar_in, bar_in + "\n");
+ test.write(bar_in, dir + "/bar.in\n");
test.run(chdir = dir) # no arguments, use the Default
diff --git a/test/Library.py b/test/Library.py
index f5e9edb..12f98f0 100644
--- a/test/Library.py
+++ b/test/Library.py
@@ -37,7 +37,7 @@ env.Library(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
env.Program(target = 'prog', source = 'prog.c')
""")
-test.write('f1.c', """
+test.write('f1.c', r"""
void
f1(void)
{
@@ -45,7 +45,7 @@ f1(void)
}
""")
-test.write('f2a.c', """
+test.write('f2a.c', r"""
void
f2a(void)
{
@@ -53,7 +53,7 @@ f2a(void)
}
""")
-test.write('f2b.c', """
+test.write('f2b.c', r"""
void
f2b(void)
{
@@ -61,7 +61,7 @@ f2b(void)
}
""")
-test.write('f2c.c', """
+test.write('f2c.c', r"""
void
f2c(void)
{
@@ -69,7 +69,7 @@ f2c(void)
}
""")
-test.write('f3a.c', """
+test.write('f3a.c', r"""
void
f3a(void)
{
@@ -77,7 +77,7 @@ f3a(void)
}
""")
-test.write('f3b.c', """
+test.write('f3b.c', r"""
void
f3b(void)
{
@@ -85,14 +85,14 @@ f3b(void)
}
""")
-test.write('f3c.c', """
+test.write('f3c.c', r"""
f3c(void)
{
printf("f3c.c\n");
}
""")
-test.write('prog.c', """
+test.write('prog.c', r"""
void f1(void);
void f2a(void);
void f2b(void);
@@ -116,7 +116,7 @@ main(int argc, char *argv[])
}
""")
-test.run(arguments = 'prog')
+test.run(arguments = '.')
test.run(program = test.workpath('prog'),
stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n")
diff --git a/test/Object.py b/test/Object.py
index 53bab36..ebbdf0f 100644
--- a/test/Object.py
+++ b/test/Object.py
@@ -24,8 +24,14 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import sys
import TestSCons
+if sys.platform == 'win32':
+ _obj = '.obj'
+else:
+ _obj = '.o'
+
test = TestSCons.TestSCons()
test.write('SConstruct', """
@@ -33,10 +39,10 @@ env = Environment()
f1 = env.Object(target = 'f1', source = 'f1.c')
f2 = env.Object(target = 'f2', source = 'f2.cpp')
f3 = env.Object(target = 'f3', source = 'f3.c')
-env.Program(target = 'prog1', source = 'f1.o f2.o f3.o prog.cpp')
+env.Program(target = 'prog1', source = 'f1%s f2%s f3%s prog.cpp')
env.Program(target = 'prog2', source = [f1, f2, f3, 'prog.cpp'])
-env.Program(target = 'prog3', source = ['f1.o', f2, 'f3.o', 'prog.cpp'])
-""")
+env.Program(target = 'prog3', source = ['f1%s', f2, 'f3%s', 'prog.cpp'])
+""" % (_obj, _obj, _obj, _obj, _obj))
test.write('f1.c', """
void
diff --git a/test/Program.py b/test/Program.py
index 80c1d95..a32c48e 100644
--- a/test/Program.py
+++ b/test/Program.py
@@ -39,7 +39,7 @@ env.Program(target = 'foo2', source = 'f2a.c f2b.c f2c.c')
env.Program(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c'])
""")
-test.write('f1.c', """
+test.write('f1.c', r"""
int
main(int argc, char *argv[])
{
@@ -49,7 +49,7 @@ main(int argc, char *argv[])
}
""")
-test.write('f2a.c', """
+test.write('f2a.c', r"""
void
f2a(void)
{
@@ -57,7 +57,7 @@ f2a(void)
}
""")
-test.write('f2b.c', """
+test.write('f2b.c', r"""
void
f2b(void)
{
@@ -65,7 +65,7 @@ f2b(void)
}
""")
-test.write('f2c.c', """
+test.write('f2c.c', r"""
extern void f2a(void);
extern void f2b(void);
int
@@ -79,7 +79,7 @@ main(int argc, char *argv[])
}
""")
-test.write('f3a.c', """
+test.write('f3a.c', r"""
void
f3a(void)
{
@@ -87,7 +87,7 @@ f3a(void)
}
""")
-test.write('f3b.c', """
+test.write('f3b.c', r"""
void
f3b(void)
{
@@ -95,7 +95,7 @@ f3b(void)
}
""")
-test.write('f3c.c', """
+test.write('f3c.c', r"""
extern void f3a(void);
extern void f3b(void);
int
@@ -117,7 +117,7 @@ test.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c\nf3c.c\n")
test.up_to_date(arguments = '.')
-test.write('f1.c', """
+test.write('f1.c', r"""
int
main(int argc, char *argv[])
{
@@ -127,7 +127,7 @@ main(int argc, char *argv[])
}
""")
-test.write('f3b.c', """
+test.write('f3b.c', r"""
void
f3b(void)
{
@@ -156,7 +156,7 @@ test.fail_test(not (oldtime1 == os.path.getmtime(test.workpath('foo1'))))
test.fail_test(not (oldtime2 == os.path.getmtime(test.workpath('foo2'))))
test.fail_test(not (oldtime3 == os.path.getmtime(test.workpath('foo3'))))
-test.write('f1.c', """
+test.write('f1.c', r"""
int
main(int argc, char *argv[])
{
@@ -166,7 +166,7 @@ main(int argc, char *argv[])
}
""")
-test.write('f3b.c', """
+test.write('f3b.c', r"""
void
f3b(void)
{
@@ -182,7 +182,7 @@ test.run(program = test.workpath('foo3'), stdout = "f3a.c\nf3b.c Y\nf3c.c\n")
test.up_to_date(arguments = 'foo1 foo2 foo3')
-test.write('f1.c', """
+test.write('f1.c', r"""
int
main(int argc, char *argv[])
{
@@ -192,7 +192,7 @@ main(int argc, char *argv[])
}
""")
-test.write('f3b.c', """
+test.write('f3b.c', r"""
void
f3b(void)
{
diff --git a/test/nonwritable-sconsign.py b/test/nonwritable-sconsign.py
index 350a63d..4bc04bb 100644
--- a/test/nonwritable-sconsign.py
+++ b/test/nonwritable-sconsign.py
@@ -34,7 +34,7 @@ env = Environment()
env.Program(target = 'foo1', source = 'f1.c')
""")
-test.write('f1.c', """
+test.write('f1.c', r"""
int
main(int argc, char *argv[])
{
diff --git a/test/subdir.py b/test/subdir.py
index 2161195..318cf82 100644
--- a/test/subdir.py
+++ b/test/subdir.py
@@ -33,8 +33,8 @@ test.subdir('subdir')
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()
""")
@@ -48,17 +48,17 @@ env.B(target = 'subdir/f3.out', source = 'subdir/f3.in')
env.B(target = 'subdir/f4.out', source = 'subdir/f4.in')
""")
-test.write('subdir/f1.in', "f1.in\n")
-test.write('subdir/f2.in', "f2.in\n")
-test.write('subdir/f3.in', "f3.in\n")
-test.write('subdir/f4.in', "f4.in\n")
+test.write(['subdir', 'f1.in'], "f1.in\n")
+test.write(['subdir', 'f2.in'], "f2.in\n")
+test.write(['subdir', 'f3.in'], "f3.in\n")
+test.write(['subdir', 'f4.in'], "f4.in\n")
test.run(arguments = 'subdir')
-test.fail_test(test.read('subdir/f1.out') != "f1.in\n")
-test.fail_test(test.read('subdir/f2.out') != "f2.in\n")
-test.fail_test(test.read('subdir/f3.out') != "f3.in\n")
-test.fail_test(test.read('subdir/f4.out') != "f4.in\n")
+test.fail_test(test.read(['subdir', 'f1.out']) != "f1.in\n")
+test.fail_test(test.read(['subdir', 'f2.out']) != "f2.in\n")
+test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\n")
+test.fail_test(test.read(['subdir', 'f4.out']) != "f4.in\n")
test.up_to_date(arguments = 'subdir')