diff options
author | Steven Knight <knight@baldmt.com> | 2004-08-05 20:00:20 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-08-05 20:00:20 (GMT) |
commit | 42629fe85a87b728d01c67e65bdbfde310744c63 (patch) | |
tree | f96bca18fdb063488c45f340ecf9a8d02902071f | |
parent | d7289a48cb622e56d940fc21c67ee6947a4d5ae1 (diff) | |
download | SCons-42629fe85a87b728d01c67e65bdbfde310744c63.zip SCons-42629fe85a87b728d01c67e65bdbfde310744c63.tar.gz SCons-42629fe85a87b728d01c67e65bdbfde310744c63.tar.bz2 |
Return lists of Nodes from all builders, not single Nodes when there's only one.
45 files changed, 587 insertions, 611 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 557db2c..fac9635 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -1163,10 +1163,8 @@ environment that consists of the tools and values that .B scons has determined are appropriate for the local system. -All builder methods return a Node or a list of Nodes, -representing the target or targets that will be built. -A list of Nodes is returned if there is more than one target, -and a single Node is returned if there is only one target. +All builder methods return a list of Nodes +that represent the target or targets that will be built. A .I Node is an internal SCons object @@ -1183,8 +1181,8 @@ to add a specific flag when compiling one specific object file: .ES -bar_obj = env.StaticObject('bar.c', CCFLAGS='-DBAR') -env.Program(source = ['foo.c', bar_obj, 'main.c']) +bar_obj_list = env.StaticObject('bar.c', CCFLAGS='-DBAR') +env.Program(source = ['foo.c', bar_obj_list, 'main.c']) .EE Using a Node in this way @@ -1193,16 +1191,28 @@ by avoiding having to specify a platform-specific object suffix when calling the Program() builder method. +(Note that Builder calls will "flatten" the lists +the source and target file list, +so it's all right to have the bar_obj list +return by the StaticObject() call +in the middle of the source file list.) + The path name for a Node's file may be used by passing the Node to the Python-builtin .B str() function: .ES -bar_obj = env.StaticObject('bar.c', CCFLAGS='-DBAR') -print "The path to bar_obj is:", str(bar_obj) +bar_obj_list = env.StaticObject('bar.c', CCFLAGS='-DBAR') +print "The path to bar_obj is:", str(bar_obj_list[0]) .EE +Note again that because the Builder call returns a list, +we have to access the first element in the list +.B (bar_obj_list[0]) +to get at the Node that actually represents +the object file. + .B scons provides the following builder methods: diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6550064..1c1829d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -148,6 +148,10 @@ RELEASE 0.96 - XXX - Don't blow up with stack trace when the external $PATH environment variable isn't set. + - Make Builder calls return lists all the time, even if there's only + one target. This keeps things consistent and easier to program to + across platforms. + From Chris Murray: - Add a .win32 attribute to force file names to expand with diff --git a/src/RELEASE.txt b/src/RELEASE.txt index 2228a83..0e63771 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -27,6 +27,33 @@ RELEASE 0.96 - XXX Please note the following important changes since release 0.95: + - All Builder calls (both built-in like Program(), Library(), + etc. and customer Builders) now always return a list of target + Nodes. If the Builder only builds one target, the Builder + call will now return a list containing that target Node, not + the target Node itself as it used to do. + + This change should be invisibile to most normal uses of the + return values from Builder calls. It will cause an error if the + SConscript file was performing some direct manipulation of the + returned Node value. For example, an attempt to print the name + of a target returned by the Object() Builder: + + target = Object('foo.c') + # OLD WAY + print target + + Will now need to access the first element in the list returned by + the Object() call: + + target = Object('foo.c') + # NEW AY + print target[0] + + This change was introduced to make the data type returned by Builder + calls consistent (always a list), regardless of platform or number + of returned targets. + - The SConsignFile() function now uses an internally-supplied SCons.dblite module as the default DB scheme for the .sconsign file. If you are using the SConsignFile() function without an explicitly @@ -58,7 +85,7 @@ RELEASE 0.96 - XXX FortranScan.add_skey('.x') => env.Append(FORTRANSUFFIXES = ['.x']) - The internal "node_factory" keyword argument has been removed; - the seperate and more flexible "target_factory" and "source_factory" + the separate and more flexible "target_factory" and "source_factory" keywords should be used instead. - SCons now treats file "extensions" that contain all digits (for diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py index 6a90c76..8306791 100644 --- a/src/engine/SCons/Action.py +++ b/src/engine/SCons/Action.py @@ -358,6 +358,7 @@ class CommandAction(ActionBase): # it is a path list, because that's a pretty # common list like value to stick in an environment # variable: + value = SCons.Util.flatten(value) ENV[key] = string.join(map(str, value), os.pathsep) elif not SCons.Util.is_String(value): # If it isn't a string or a list, then @@ -494,13 +495,13 @@ class FunctionAction(ActionBase): return "unknown_python_function" def strfunction(self, target, source, env): - def quote(s): - return '"' + str(s) + '"' - def array(a, q=quote): - return '[' + string.join(map(lambda x, q=q: q(x), a), ", ") + ']' + def array(a): + def quote(s): + return '"' + str(s) + '"' + return '[' + string.join(map(quote, a), ", ") + ']' name = self.function_name() - tstr = len(target) == 1 and quote(target[0]) or array(target) - sstr = len(source) == 1 and quote(source[0]) or array(source) + tstr = array(target) + sstr = array(source) return "%s(%s, %s)" % (name, tstr, sstr) def __str__(self): diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py index 9a89623..4c1649c 100644 --- a/src/engine/SCons/ActionTests.py +++ b/src/engine/SCons/ActionTests.py @@ -374,7 +374,7 @@ class ActionBaseTestCase(unittest.TestCase): result = a("out", "in", env) assert result == 7, result s = sio.getvalue() - assert s == 'execfunc("out", "in")\n', s + assert s == 'execfunc(["out"], ["in"])\n', s SCons.Action.execute_actions = 0 @@ -383,7 +383,7 @@ class ActionBaseTestCase(unittest.TestCase): result = a("out", "in", env) assert result == 0, result s = sio.getvalue() - assert s == 'execfunc("out", "in")\n', s + assert s == 'execfunc(["out"], ["in"])\n', s SCons.Action.print_actions_presub = 1 @@ -392,14 +392,14 @@ class ActionBaseTestCase(unittest.TestCase): result = a("out", "in", env) assert result == 0, result s = sio.getvalue() - assert s == 'execfunc("out", "in")\n', s + assert s == 'execfunc(["out"], ["in"])\n', s sio = StringIO.StringIO() sys.stdout = sio result = a("out", "in", env, presub=1) assert result == 0, result s = sio.getvalue() - assert s == 'Building out with action(s):\n execfunc(env, target, source)\nexecfunc("out", "in")\n', s + assert s == 'Building out with action(s):\n execfunc(env, target, source)\nexecfunc(["out"], ["in"])\n', s a2 = SCons.Action.Action(execfunc) @@ -408,14 +408,14 @@ class ActionBaseTestCase(unittest.TestCase): result = a2("out", "in", env) assert result == 0, result s = sio.getvalue() - assert s == 'Building out with action(s):\n execfunc(env, target, source)\nexecfunc("out", "in")\n', s + assert s == 'Building out with action(s):\n execfunc(env, target, source)\nexecfunc(["out"], ["in"])\n', s sio = StringIO.StringIO() sys.stdout = sio result = a2("out", "in", env, presub=0) assert result == 0, result s = sio.getvalue() - assert s == 'execfunc("out", "in")\n', s + assert s == 'execfunc(["out"], ["in"])\n', s sio = StringIO.StringIO() sys.stdout = sio diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index 57f50c9..e6e7822 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -547,13 +547,11 @@ class BuilderBase: if len(tlist) == 1: builder = self - result = tlist[0] else: builder = ListBuilder(self, env, tlist) - result = tlist _init_nodes(builder, env, overwarn.data, tlist, slist) - return result + return tlist def __call__(self, env, target = None, source = _null, **kw): return self._execute(env, target, source, OverrideWarner(kw)) @@ -711,16 +709,14 @@ class MultiStepBuilder(BuilderBase): final_sources.append(snode) else: tgt = subsidiary_builder._execute(env, None, snode, overwarn) - # Only supply the builder with sources it is capable - # of building. - if SCons.Util.is_List(tgt): + # If the subsidiary Builder returned more than one target, + # then filter out any sources that this Builder isn't + # capable of building. + if len(tgt) > 1: tgt = filter(lambda x, self=self, suf=src_suffixes: self.splitext(SCons.Util.to_String(x))[1] in suf, tgt) - if not SCons.Util.is_List(tgt): - final_sources.append(tgt) - else: - final_sources.extend(tgt) + final_sources.extend(tgt) return BuilderBase._execute(self, env, target, final_sources, overwarn) diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py index 57e9f28..5a605ec 100644 --- a/src/engine/SCons/BuilderTests.py +++ b/src/engine/SCons/BuilderTests.py @@ -214,15 +214,15 @@ class BuilderTestCase(unittest.TestCase): assert n1.executor, "no executor found" assert not hasattr(n2, 'env') - target = builder(env, target = 'n3', source = 'n4') + target = builder(env, target = 'n3', source = 'n4')[0] assert target.name == 'n3' assert target.sources[0].name == 'n4' - target = builder(env, target = 'n4 n5', source = ['n6 n7']) + target = builder(env, target = 'n4 n5', source = ['n6 n7'])[0] assert target.name == 'n4 n5' assert target.sources[0].name == 'n6 n7' - target = builder(env, target = ['n8 n9'], source = 'n10 n11') + target = builder(env, target = ['n8 n9'], source = 'n10 n11')[0] assert target.name == 'n8 n9' assert target.sources[0].name == 'n10 n11' @@ -240,12 +240,12 @@ class BuilderTestCase(unittest.TestCase): uni = unicode target = builder(env, target = uni('n12 n13'), - source = [uni('n14 n15')]) + source = [uni('n14 n15')])[0] assert target.name == uni('n12 n13') assert target.sources[0].name == uni('n14 n15') target = builder(env, target = [uni('n16 n17')], - source = uni('n18 n19')) + source = uni('n18 n19'))[0] assert target.name == uni('n16 n17') assert target.sources[0].name == uni('n18 n19') @@ -262,7 +262,7 @@ class BuilderTestCase(unittest.TestCase): source_factory=MyNode, prefix='p-', suffix='.s') - target = builder(env, source='n21') + target = builder(env, source='n21')[0] assert target.name == 'p-n21.s', target def test_mistaken_variables(self): @@ -395,19 +395,19 @@ class BuilderTestCase(unittest.TestCase): assert builder.get_prefix(env) == 'lib.' builder = SCons.Builder.Builder(prefix = 'lib') assert builder.get_prefix(env) == 'lib' - tgt = builder(env, target = 'tgt1', source = 'src1') + tgt = builder(env, target = 'tgt1', source = 'src1')[0] assert tgt.path == 'libtgt1', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, target = 'tgt2a tgt2b', source = 'src2') + tgt = builder(env, target = 'tgt2a tgt2b', source = 'src2')[0] assert tgt.path == 'libtgt2a tgt2b', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, source = 'src3') + tgt = builder(env, source = 'src3')[0] assert tgt.path == 'libsrc3', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, source = 'lib/src4') + tgt = builder(env, source = 'lib/src4')[0] assert tgt.path == os.path.join('lib', 'libsrc4'), \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, target = 'lib/tgt5', source = 'lib/src5') + tgt = builder(env, target = 'lib/tgt5', source = 'lib/src5')[0] assert tgt.path == os.path.join('lib', 'libtgt5'), \ "Target has unexpected name: %s" % tgt.path @@ -427,17 +427,17 @@ class BuilderTestCase(unittest.TestCase): '.x' : 'y-', '$FOO' : 'foo-', '.zzz' : my_emit}) - tgt = builder(my_env, source = 'f1') + tgt = builder(my_env, source = 'f1')[0] assert tgt.path == 'default-f1', tgt.path - tgt = builder(my_env, source = 'f2.c') + tgt = builder(my_env, source = 'f2.c')[0] assert tgt.path == 'default-f2', tgt.path - tgt = builder(my_env, source = 'f3.in') + tgt = builder(my_env, source = 'f3.in')[0] assert tgt.path == 'out-f3', tgt.path - tgt = builder(my_env, source = 'f4.x') + tgt = builder(my_env, source = 'f4.x')[0] assert tgt.path == 'y-f4', tgt.path - tgt = builder(my_env, source = 'f5.foo') + tgt = builder(my_env, source = 'f5.foo')[0] assert tgt.path == 'foo-f5', tgt.path - tgt = builder(my_env, source = 'f6.zzz') + tgt = builder(my_env, source = 'f6.zzz')[0] assert tgt.path == 'emit-f6', tgt.path def test_src_suffix(self): @@ -451,11 +451,11 @@ class BuilderTestCase(unittest.TestCase): b1 = SCons.Builder.Builder(src_suffix = '.c') assert b1.src_suffixes(env) == ['.c'], b1.src_suffixes(env) - tgt = b1(env, target = 'tgt2', source = 'src2') + tgt = b1(env, target = 'tgt2', source = 'src2')[0] assert tgt.sources[0].path == 'src2.c', \ "Source has unexpected name: %s" % tgt.sources[0].path - tgt = b1(env, target = 'tgt3', source = 'src3a src3b') + tgt = b1(env, target = 'tgt3', source = 'src3a src3b')[0] assert len(tgt.sources) == 1 assert tgt.sources[0].path == 'src3a src3b.c', \ "Unexpected tgt.sources[0] name: %s" % tgt.sources[0].path @@ -485,13 +485,13 @@ class BuilderTestCase(unittest.TestCase): assert builder.get_suffix(env) == '.o', builder.get_suffix(env) builder = SCons.Builder.Builder(suffix = 'o') assert builder.get_suffix(env) == '.o', builder.get_suffix(env) - tgt = builder(env, target = 'tgt3', source = 'src3') + tgt = builder(env, target = 'tgt3', source = 'src3')[0] assert tgt.path == 'tgt3.o', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, target = 'tgt4a tgt4b', source = 'src4') + tgt = builder(env, target = 'tgt4a tgt4b', source = 'src4')[0] assert tgt.path == 'tgt4a tgt4b.o', \ "Target has unexpected name: %s" % tgt.path - tgt = builder(env, source = 'src5') + tgt = builder(env, source = 'src5')[0] assert tgt.path == 'src5.o', \ "Target has unexpected name: %s" % tgt.path @@ -511,17 +511,17 @@ class BuilderTestCase(unittest.TestCase): '.x' : '.y', '$BAR' : '.new', '.zzz' : my_emit}) - tgt = builder(my_env, source = 'f1') + tgt = builder(my_env, source = 'f1')[0] assert tgt.path == 'f1.default', tgt.path - tgt = builder(my_env, source = 'f2.c') + tgt = builder(my_env, source = 'f2.c')[0] assert tgt.path == 'f2.default', tgt.path - tgt = builder(my_env, source = 'f3.in') + tgt = builder(my_env, source = 'f3.in')[0] assert tgt.path == 'f3.out', tgt.path - tgt = builder(my_env, source = 'f4.x') + tgt = builder(my_env, source = 'f4.x')[0] assert tgt.path == 'f4.y', tgt.path - tgt = builder(my_env, source = 'f5.bar') + tgt = builder(my_env, source = 'f5.bar')[0] assert tgt.path == 'f5.new', tgt.path - tgt = builder(my_env, source = 'f6.zzz') + tgt = builder(my_env, source = 'f6.zzz')[0] assert tgt.path == 'f6.emit', tgt.path def test_single_source(self): @@ -541,11 +541,11 @@ class BuilderTestCase(unittest.TestCase): builder = SCons.Builder.Builder(action=SCons.Action.Action(func,None), single_source = 1, suffix='.out') env['CNT'] = [0] - tgt = builder(env, target=outfiles[0], source=infiles[0]) + tgt = builder(env, target=outfiles[0], source=infiles[0])[0] tgt.prepare() tgt.build() assert env['CNT'][0] == 1, env['CNT'][0] - tgt = builder(env, outfiles[1], infiles[1]) + tgt = builder(env, outfiles[1], infiles[1])[0] tgt.prepare() tgt.build() assert env['CNT'][0] == 2 @@ -629,14 +629,15 @@ class BuilderTestCase(unittest.TestCase): src_builder = builder1, src_suffix = '.foo') - tgt = builder2(env, target='baz', source=['test.bar', 'test2.foo', 'test3.txt']) + tgt = builder2(env, target='baz', + source=['test.bar', 'test2.foo', 'test3.txt'])[0] assert str(tgt.sources[0]) == 'test.foo', str(tgt.sources[0]) assert str(tgt.sources[0].sources[0]) == 'test.bar', \ str(tgt.sources[0].sources[0]) assert str(tgt.sources[1]) == 'test2.foo', str(tgt.sources[1]) assert str(tgt.sources[2]) == 'test3.txt', str(tgt.sources[2]) - tgt = builder2(env, 'aaa.bar') + tgt = builder2(env, 'aaa.bar')[0] assert str(tgt) == 'aaa', str(tgt) assert str(tgt.sources[0]) == 'aaa.foo', str(tgt.sources[0]) assert str(tgt.sources[0].sources[0]) == 'aaa.bar', \ @@ -658,7 +659,7 @@ class BuilderTestCase(unittest.TestCase): src_builder=builder5, suffix='.exe', src_suffix='.obj') - tgt = builder6(env, 'test', 'test.i') + tgt = builder6(env, 'test', 'test.i')[0] assert str(tgt) == 'test.exe', str(tgt) assert str(tgt.sources[0]) == 'test_wrap.obj', str(tgt.sources[0]) assert str(tgt.sources[0].sources[0]) == 'test_wrap.c', \ @@ -679,14 +680,14 @@ class BuilderTestCase(unittest.TestCase): assert isinstance(builder, SCons.Builder.CompositeBuilder) assert isinstance(builder.action, SCons.Action.CommandGeneratorAction) - tgt = builder(env, target='test1', source='test1.foo') + tgt = builder(env, target='test1', source='test1.foo')[0] assert isinstance(tgt.builder, SCons.Builder.BuilderBase) assert tgt.builder.action is builder.action - tgt = builder(env, target='test2', source='test1.bar') + tgt = builder(env, target='test2', source='test1.bar')[0] assert isinstance(tgt.builder, SCons.Builder.BuilderBase) assert tgt.builder.action is builder.action flag = 0 - tgt = builder(env, target='test3', source=['test2.bar', 'test1.foo']) + tgt = builder(env, target='test3', source=['test2.bar', 'test1.foo'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -695,7 +696,7 @@ class BuilderTestCase(unittest.TestCase): match = str(e) == "While building `['test3']' from `test1.foo': Cannot build multiple sources with different extensions: .bar, .foo" assert match, e - tgt = builder(env, target='test4', source=['test4.BAR2']) + tgt = builder(env, target='test4', source=['test4.BAR2'])[0] assert isinstance(tgt.builder, SCons.Builder.BuilderBase) try: tgt.build() @@ -707,7 +708,7 @@ class BuilderTestCase(unittest.TestCase): env['FOO_SUFFIX'] = '.BAR2' builder.add_action('$NEW_SUFFIX', func_action) flag = 0 - tgt = builder(env, target='test5', source=['test5.BAR2']) + tgt = builder(env, target='test5', source=['test5.BAR2'])[0] try: tgt.build() except SCons.Errors.UserError: @@ -726,10 +727,10 @@ class BuilderTestCase(unittest.TestCase): assert isinstance(builder, SCons.Builder.CompositeBuilder) assert isinstance(builder.action, SCons.Action.CommandGeneratorAction) - tgt = builder(env, target='t1', source='t1a.ina t1b.ina') + tgt = builder(env, target='t1', source='t1a.ina t1b.ina')[0] assert isinstance(tgt.builder, SCons.Builder.BuilderBase) - tgt = builder(env, target='t2', source='t2a.foo t2b.ina') + tgt = builder(env, target='t2', source='t2a.foo t2b.ina')[0] assert isinstance(tgt.builder, SCons.Builder.MultiStepBuilder), tgt.builder.__dict__ bar_bld = SCons.Builder.Builder(action = 'a-bar', @@ -743,14 +744,14 @@ class BuilderTestCase(unittest.TestCase): builder.add_action('.bar', 'bar') - tgt = builder(env, target='t3-foo', source='t3a.foo t3b.ina') + tgt = builder(env, target='t3-foo', source='t3a.foo t3b.ina')[0] assert isinstance(tgt.builder, SCons.Builder.MultiStepBuilder) - tgt = builder(env, target='t3-bar', source='t3a.bar t3b.inb') + tgt = builder(env, target='t3-bar', source='t3a.bar t3b.inb')[0] assert isinstance(tgt.builder, SCons.Builder.MultiStepBuilder) flag = 0 - tgt = builder(env, target='t5', source=['test5a.foo', 'test5b.inb']) + tgt = builder(env, target='t5', source=['test5a.foo', 'test5b.inb'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -760,7 +761,7 @@ class BuilderTestCase(unittest.TestCase): assert match, e flag = 0 - tgt = builder(env, target='t6', source=['test6a.bar', 'test6b.ina']) + tgt = builder(env, target='t6', source=['test6a.bar', 'test6b.ina'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -770,7 +771,7 @@ class BuilderTestCase(unittest.TestCase): assert match, e flag = 0 - tgt = builder(env, target='t4', source=['test4a.ina', 'test4b.inb']) + tgt = builder(env, target='t4', source=['test4a.ina', 'test4b.inb'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -780,7 +781,7 @@ class BuilderTestCase(unittest.TestCase): assert match, e flag = 0 - tgt = builder(env, target='t7', source=['test7']) + tgt = builder(env, target='t7', source=['test7'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -790,7 +791,7 @@ class BuilderTestCase(unittest.TestCase): assert match, e flag = 0 - tgt = builder(env, target='t8', source=['test8.unknown']) + tgt = builder(env, target='t8', source=['test8.unknown'])[0] try: tgt.build() except SCons.Errors.UserError, e: @@ -809,7 +810,7 @@ class BuilderTestCase(unittest.TestCase): env = Environment() builder = SCons.Builder.Builder(target_scanner=tscan, source_scanner=sscan) - tgt = builder(env, target='foo2', source='bar') + tgt = builder(env, target='foo2', source='bar')[0] assert tgt.target_scanner == tscan, tgt.target_scanner assert tgt.source_scanner == sscan, tgt.source_scanner @@ -820,7 +821,7 @@ class BuilderTestCase(unittest.TestCase): src_builder = builder1, target_scanner = tscan, source_scanner = tscan) - tgt = builder2(env, target='baz2', source='test.bar test2.foo test3.txt') + tgt = builder2(env, target='baz2', source='test.bar test2.foo test3.txt')[0] assert tgt.target_scanner == tscan, tgt.target_scanner assert tgt.source_scanner == tscan, tgt.source_scanner @@ -838,7 +839,7 @@ class BuilderTestCase(unittest.TestCase): # With no scanner specified, source_scanner and # backup_source_scanner are None. env1 = Environment() - tgt = builder(env1, target='foo1.x', source='bar.y') + tgt = builder(env1, target='foo1.x', source='bar.y')[0] src = tgt.sources[0] assert tgt.target_scanner != scanner, tgt.target_scanner assert src.source_scanner is None, src.source_scanner @@ -848,7 +849,7 @@ class BuilderTestCase(unittest.TestCase): # has a scanner must still set the scanner. env2 = Environment() env2.scanner = scanner - tgt = builder(env2, target='foo2.x', source='bar.y') + tgt = builder(env2, target='foo2.x', source='bar.y')[0] src = tgt.sources[0] assert tgt.target_scanner != scanner, tgt.target_scanner assert src.source_scanner is None, src.source_scanner @@ -864,7 +865,7 @@ class BuilderTestCase(unittest.TestCase): env=Environment(CC='cc') builder = SCons.Builder.Builder(action=buildFunc) - tgt = builder(env, target='foo', source='bar', foo=1, bar=2, CC='mycc') + tgt = builder(env, target='foo', source='bar', foo=1, bar=2, CC='mycc')[0] tgt.build() assert self.foo == 1, self.foo assert self.bar == 2, self.bar @@ -890,7 +891,7 @@ class BuilderTestCase(unittest.TestCase): emitter=emit, target_factory=MyNode, source_factory=MyNode) - tgt = builder(env, target='foo2', source='bar') + tgt = builder(env, target='foo2', source='bar')[0] assert str(tgt) == 'foo2', str(tgt) assert str(tgt.sources[0]) == 'bar', str(tgt.sources[0]) @@ -899,7 +900,7 @@ class BuilderTestCase(unittest.TestCase): assert 'foo3' in map(str, tgt), map(str, tgt) assert 'bar1' in map(str, tgt), map(str, tgt) - tgt = builder(env, target='foo4', source='bar', bar=1) + tgt = builder(env, target='foo4', source='bar', bar=1)[0] assert str(tgt) == 'foo4', str(tgt) assert len(tgt.sources) == 2, len(tgt.sources) assert 'baz' in map(str, tgt.sources), map(str, tgt.sources) @@ -911,7 +912,7 @@ class BuilderTestCase(unittest.TestCase): target_factory=MyNode, source_factory=MyNode) - tgt = builder2(env2, target='foo5', source='bar') + tgt = builder2(env2, target='foo5', source='bar')[0] assert str(tgt) == 'foo5', str(tgt) assert str(tgt.sources[0]) == 'bar', str(tgt.sources[0]) @@ -920,7 +921,7 @@ class BuilderTestCase(unittest.TestCase): assert 'foo6' in map(str, tgt), map(str, tgt) assert 'bar2' in map(str, tgt), map(str, tgt) - tgt = builder2(env2, target='foo7', source='bar', bar=1) + tgt = builder2(env2, target='foo7', source='bar', bar=1)[0] assert str(tgt) == 'foo7', str(tgt) assert len(tgt.sources) == 2, len(tgt.sources) assert 'baz' in map(str, tgt.sources), map(str, tgt.sources) @@ -947,7 +948,7 @@ class BuilderTestCase(unittest.TestCase): emitter=emit3, target_factory=MyNode, source_factory=MyNode) - tgt = builder3(env, target=node, source='bar') + tgt = builder3(env, target=node, source='bar')[0] assert tgt is new_node, tgt assert tgt.builder is builder3, tgt.builder assert node.builder is new_builder, node.builder @@ -967,11 +968,11 @@ class BuilderTestCase(unittest.TestCase): '.4b':emit4b}, target_factory=MyNode, source_factory=MyNode) - tgt = builder4(env, source='aaa.4a') + tgt = builder4(env, source='aaa.4a')[0] assert str(tgt) == 'emit4a-aaa', str(tgt) - tgt = builder4(env, source='bbb.4b') + tgt = builder4(env, source='bbb.4b')[0] assert str(tgt) == 'emit4b-bbb', str(tgt) - tgt = builder4(env, source='ccc.4c') + tgt = builder4(env, source='ccc.4c')[0] assert str(tgt) == 'ccc', str(tgt) def emit4c(target, source, env): @@ -979,7 +980,7 @@ class BuilderTestCase(unittest.TestCase): target = map(lambda x: 'emit4c-' + x[:-3], source) return (target, source) builder4.add_emitter('.4c', emit4c) - tgt = builder4(env, source='ccc.4c') + tgt = builder4(env, source='ccc.4c')[0] assert str(tgt) == 'emit4c-ccc', str(tgt) # Test a list of emitter functions. @@ -1024,51 +1025,51 @@ class BuilderTestCase(unittest.TestCase): env = Environment() b = SCons.Builder.Builder(action='foo', suffix='.o') - tgt = b(env, 'aaa') + tgt = b(env, 'aaa')[0] assert str(tgt) == 'aaa.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'aaa', map(str, tgt.sources) - tgt = b(env, 'bbb.c') + tgt = b(env, 'bbb.c')[0] assert str(tgt) == 'bbb.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'bbb.c', map(str, tgt.sources) - tgt = b(env, 'ccc.x.c') + tgt = b(env, 'ccc.x.c')[0] assert str(tgt) == 'ccc.x.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'ccc.x.c', map(str, tgt.sources) - tgt = b(env, ['d0.c', 'd1.c']) + tgt = b(env, ['d0.c', 'd1.c'])[0] assert str(tgt) == 'd0.o', str(tgt) assert len(tgt.sources) == 2, map(str, tgt.sources) assert str(tgt.sources[0]) == 'd0.c', map(str, tgt.sources) assert str(tgt.sources[1]) == 'd1.c', map(str, tgt.sources) - tgt = b(env, source='eee') + tgt = b(env, source='eee')[0] assert str(tgt) == 'eee.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'eee', map(str, tgt.sources) - tgt = b(env, source='fff.c') + tgt = b(env, source='fff.c')[0] assert str(tgt) == 'fff.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'fff.c', map(str, tgt.sources) - tgt = b(env, source='ggg.x.c') + tgt = b(env, source='ggg.x.c')[0] assert str(tgt) == 'ggg.x.o', str(tgt) assert len(tgt.sources) == 1, map(str, tgt.sources) assert str(tgt.sources[0]) == 'ggg.x.c', map(str, tgt.sources) - tgt = b(env, source=['h0.c', 'h1.c']) + tgt = b(env, source=['h0.c', 'h1.c'])[0] assert str(tgt) == 'h0.o', str(tgt) assert len(tgt.sources) == 2, map(str, tgt.sources) assert str(tgt.sources[0]) == 'h0.c', map(str, tgt.sources) assert str(tgt.sources[1]) == 'h1.c', map(str, tgt.sources) - w = b(env, target='i0.w', source=['i0.x']) - y = b(env, target='i1.y', source=['i1.z']) - tgt = b(env, source=[w, y]) + w = b(env, target='i0.w', source=['i0.x'])[0] + y = b(env, target='i1.y', source=['i1.z'])[0] + tgt = b(env, source=[w, y])[0] assert str(tgt) == 'i0.o', str(tgt) assert len(tgt.sources) == 2, map(str, tgt.sources) assert str(tgt.sources[0]) == 'i0.w', map(str, tgt.sources) diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 0e79eb4..8e0c5ee 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -338,7 +338,9 @@ class Base: if not args: return [] - if not SCons.Util.is_List(args): + if SCons.Util.is_List(args): + args = SCons.Util.flatten(args) + else: args = [args] nodes = [] @@ -354,10 +356,16 @@ class Base: n = self.subst(n, raw=1) if node_factory: n = node_factory(n) - nodes.append(n) + try: + nodes.extend(n) + except TypeError: + nodes.append(n) elif node_factory: - v = self.subst(v, raw=1) - nodes.append(node_factory(v)) + v = node_factory(self.subst(v, raw=1)) + try: + nodes.extend(v) + except TypeError: + nodes.append(v) else: nodes.append(v) @@ -964,20 +972,14 @@ class Base: s = self.arg2nodes(s, self.fs.Entry) for t in tlist: AliasBuilder(self, t, s) - if len(tlist) == 1: - tlist = tlist[0] return tlist def AlwaysBuild(self, *targets): tlist = [] for t in targets: tlist.extend(self.arg2nodes(t, self.fs.File)) - for t in tlist: t.set_always_build() - - if len(tlist) == 1: - tlist = tlist[0] return tlist def BuildDir(self, build_dir, src_dir, duplicate=1): @@ -1042,9 +1044,6 @@ class Base: dlist = self.arg2nodes(dependency, self.fs.Entry) for t in tlist: t.add_dependency(dlist) - - if len(tlist) == 1: - tlist = tlist[0] return tlist def Dir(self, name, *args, **kw): @@ -1072,10 +1071,11 @@ class Base: return SCons.Node.FS.find_file(file, nodes, self.fs.File) def GetBuildPath(self, files): - ret = map(str, self.arg2nodes(files, self.fs.Entry)) - if len(ret) == 1: - return ret[0] - return ret + result = map(str, self.arg2nodes(files, self.fs.Entry)) + if SCons.Util.is_List(files): + return result + else: + return result[0] def Ignore(self, target, dependency): """Ignore a dependency.""" @@ -1083,9 +1083,6 @@ class Base: dlist = self.arg2nodes(dependency, self.fs.Entry) for t in tlist: t.add_ignore(dlist) - - if len(tlist) == 1: - tlist = tlist[0] return tlist def Install(self, dir, source): @@ -1105,21 +1102,17 @@ class Base: for dnode in dnodes: for src in sources: target = self.fs.File(src.name, dnode) - tgt.append(InstallBuilder(self, target, src)) - if len(tgt) == 1: - tgt = tgt[0] + tgt.extend(InstallBuilder(self, target, src)) return tgt def InstallAs(self, target, source): """Install sources as targets.""" sources = self.arg2nodes(source, self.fs.File) targets = self.arg2nodes(target, self.fs.File) - ret = [] + result = [] for src, tgt in map(lambda x, y: (x, y), sources, targets): - ret.append(InstallBuilder(self, tgt, src)) - if len(ret) == 1: - ret = ret[0] - return ret + result.extend(InstallBuilder(self, tgt, src)) + return result def Literal(self, string): return SCons.Util.Literal(string) @@ -1140,12 +1133,8 @@ class Base: tlist = [] for t in targets: tlist.extend(self.arg2nodes(t, self.fs.Entry)) - for t in tlist: t.set_precious() - - if len(tlist) == 1: - tlist = tlist[0] return tlist def Repository(self, *dirs, **kw): @@ -1181,18 +1170,13 @@ class Base: self.Precious(side_effect) for target in targets: target.side_effects.append(side_effect) - if len(side_effects) == 1: - return side_effects[0] - else: - return side_effects + return side_effects def SourceCode(self, entry, builder): """Arrange for a source code builder for (part of) a tree.""" entries = self.arg2nodes(entry, self.fs.Entry) for entry in entries: entry.set_src_builder(builder) - if len(entries) == 1: - return entries[0] return entries def SourceSignatures(self, type): diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index c65fb03..1b2ceec 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1733,31 +1733,31 @@ class EnvironmentTestCase(unittest.TestCase): """Test the Alias() method""" env = Environment(FOO='kkk', BAR='lll', EA='export_alias') - tgt = env.Alias('new_alias') + tgt = env.Alias('new_alias')[0] assert str(tgt) == 'new_alias', tgt assert tgt.sources == [], tgt.sources - tgt = env.Alias('None_alias', None) + tgt = env.Alias('None_alias', None)[0] assert str(tgt) == 'None_alias', tgt assert tgt.sources == [], tgt.sources - tgt = env.Alias('empty_list', []) + tgt = env.Alias('empty_list', [])[0] assert str(tgt) == 'empty_list', tgt assert tgt.sources == [], tgt.sources - tgt = env.Alias('export_alias', [ 'asrc1', '$FOO' ]) + tgt = env.Alias('export_alias', [ 'asrc1', '$FOO' ])[0] assert str(tgt) == 'export_alias', tgt assert len(tgt.sources) == 2, map(str, tgt.sources) assert str(tgt.sources[0]) == 'asrc1', map(str, tgt.sources) assert str(tgt.sources[1]) == 'kkk', map(str, tgt.sources) - n = env.Alias(tgt, source = ['$BAR', 'asrc4']) + n = env.Alias(tgt, source = ['$BAR', 'asrc4'])[0] assert n is tgt, n assert len(tgt.sources) == 4, map(str, tgt.sources) assert str(tgt.sources[2]) == 'lll', map(str, tgt.sources) assert str(tgt.sources[3]) == 'asrc4', map(str, tgt.sources) - n = env.Alias('$EA', 'asrc5') + n = env.Alias('$EA', 'asrc5')[0] assert n is tgt, n assert len(tgt.sources) == 5, map(str, tgt.sources) assert str(tgt.sources[4]) == 'asrc5', map(str, tgt.sources) @@ -1880,7 +1880,7 @@ class EnvironmentTestCase(unittest.TestCase): """Test the Command() method.""" env = Environment() t = env.Command(target='foo.out', source=['foo1.in', 'foo2.in'], - action='buildfoo $target $source') + action='buildfoo $target $source')[0] assert not t.builder is None assert t.builder.action.__class__.__name__ == 'CommandAction' assert t.builder.action.cmd_list == 'buildfoo $target $source' @@ -1889,7 +1889,7 @@ class EnvironmentTestCase(unittest.TestCase): sub = SCons.Node.FS.default_fs.Dir('sub') t = env.Command(target='bar.out', source='sub', - action='buildbar $target $source') + action='buildbar $target $source')[0] assert 'sub' in map(lambda x: x.path, t.sources) def testFunc(env, target, source): @@ -1897,7 +1897,7 @@ class EnvironmentTestCase(unittest.TestCase): assert 'foo1.in' in map(str, source) and 'foo2.in' in map(str, source), map(str, source) return 0 t = env.Command(target='foo.out', source=['foo1.in','foo2.in'], - action=testFunc) + action=testFunc)[0] assert not t.builder is None assert t.builder.action.__class__.__name__ == 'FunctionAction' t.build() @@ -1910,7 +1910,7 @@ class EnvironmentTestCase(unittest.TestCase): env = Environment(TEST2 = test2) t = env.Command(target='baz.out', source='baz.in', action='${TEST2(XYZ)}', - XYZ='magic word') + XYZ='magic word')[0] assert not t.builder is None t.build() assert x[0] == 'magic word', x @@ -1951,7 +1951,8 @@ class EnvironmentTestCase(unittest.TestCase): env.Dir('dir2') env.File('xxx.py') env.File('yyy.py') - t = env.Depends(target='EnvironmentTest.py', dependency='Environment.py') + t = env.Depends(target='EnvironmentTest.py', + dependency='Environment.py')[0] assert t.__class__.__name__ == 'Entry', t.__class__.__name__ assert t.path == 'EnvironmentTest.py' assert len(t.depends) == 1 @@ -1959,7 +1960,7 @@ class EnvironmentTestCase(unittest.TestCase): assert d.__class__.__name__ == 'Entry', d.__class__.__name__ assert d.path == 'Environment.py' - t = env.Depends(target='${FOO}.py', dependency='${BAR}.py') + t = env.Depends(target='${FOO}.py', dependency='${BAR}.py')[0] assert t.__class__.__name__ == 'File', t.__class__.__name__ assert t.path == 'xxx.py' assert len(t.depends) == 1 @@ -1967,7 +1968,7 @@ class EnvironmentTestCase(unittest.TestCase): assert d.__class__.__name__ == 'File', d.__class__.__name__ assert d.path == 'yyy.py' - t = env.Depends(target='dir1', dependency='dir2') + t = env.Depends(target='dir1', dependency='dir2')[0] assert t.__class__.__name__ == 'Dir', t.__class__.__name__ assert t.path == 'dir1' assert len(t.depends) == 1 @@ -2061,7 +2062,7 @@ class EnvironmentTestCase(unittest.TestCase): env.File('yyyzzz') env.File('zzzyyy') - t = env.Ignore(target='targ.py', dependency='dep.py') + t = env.Ignore(target='targ.py', dependency='dep.py')[0] assert t.__class__.__name__ == 'Entry', t.__class__.__name__ assert t.path == 'targ.py' assert len(t.ignore) == 1 @@ -2069,7 +2070,7 @@ class EnvironmentTestCase(unittest.TestCase): assert i.__class__.__name__ == 'Entry', i.__class__.__name__ assert i.path == 'dep.py' - t = env.Ignore(target='$FOO$BAR', dependency='$BAR$FOO') + t = env.Ignore(target='$FOO$BAR', dependency='$BAR$FOO')[0] assert t.__class__.__name__ == 'File', t.__class__.__name__ assert t.path == 'yyyzzz' assert len(t.ignore) == 1 @@ -2077,7 +2078,7 @@ class EnvironmentTestCase(unittest.TestCase): assert i.__class__.__name__ == 'File', i.__class__.__name__ assert i.path == 'zzzyyy' - t = env.Ignore(target='dir1', dependency='dir2') + t = env.Ignore(target='dir1', dependency='dir2')[0] assert t.__class__.__name__ == 'Dir', t.__class__.__name__ assert t.path == 'dir1' assert len(t.ignore) == 1 @@ -2146,7 +2147,7 @@ class EnvironmentTestCase(unittest.TestCase): for tnode in tgt: assert tnode.builder == InstallBuilder - tgt = env.InstallAs(target='${FOO}.t', source='${BAR}.s') + tgt = env.InstallAs(target='${FOO}.t', source='${BAR}.s')[0] assert tgt.path == 'iii.t' assert tgt.sources[0].path == 'jjj.s' assert tgt.builder == InstallBuilder @@ -2282,9 +2283,9 @@ class EnvironmentTestCase(unittest.TestCase): env.File('mylll.pdb') env.Dir('mymmm.pdb') - foo = env.Object('foo.obj', 'foo.cpp') - bar = env.Object('bar.obj', 'bar.cpp') - s = env.SideEffect('mylib.pdb', ['foo.obj', 'bar.obj']) + foo = env.Object('foo.obj', 'foo.cpp')[0] + bar = env.Object('bar.obj', 'bar.cpp')[0] + s = env.SideEffect('mylib.pdb', ['foo.obj', 'bar.obj'])[0] assert s.__class__.__name__ == 'Entry', s.__class__.__name__ assert s.path == 'mylib.pdb' assert s.side_effect @@ -2293,9 +2294,9 @@ class EnvironmentTestCase(unittest.TestCase): assert s.depends_on([bar]) assert s.depends_on([foo]) - fff = env.Object('fff.obj', 'fff.cpp') - bbb = env.Object('bbb.obj', 'bbb.cpp') - s = env.SideEffect('my${LIB}.pdb', ['${FOO}.obj', '${BAR}.obj']) + fff = env.Object('fff.obj', 'fff.cpp')[0] + bbb = env.Object('bbb.obj', 'bbb.cpp')[0] + s = env.SideEffect('my${LIB}.pdb', ['${FOO}.obj', '${BAR}.obj'])[0] assert s.__class__.__name__ == 'File', s.__class__.__name__ assert s.path == 'mylll.pdb' assert s.side_effect @@ -2304,9 +2305,9 @@ class EnvironmentTestCase(unittest.TestCase): assert s.depends_on([bbb]) assert s.depends_on([fff]) - ggg = env.Object('ggg.obj', 'ggg.cpp') - ccc = env.Object('ccc.obj', 'ccc.cpp') - s = env.SideEffect('mymmm.pdb', ['ggg.obj', 'ccc.obj']) + ggg = env.Object('ggg.obj', 'ggg.cpp')[0] + ccc = env.Object('ccc.obj', 'ccc.cpp')[0] + s = env.SideEffect('mymmm.pdb', ['ggg.obj', 'ccc.obj'])[0] assert s.__class__.__name__ == 'Dir', s.__class__.__name__ assert s.path == 'mymmm.pdb' assert s.side_effect @@ -2318,18 +2319,18 @@ class EnvironmentTestCase(unittest.TestCase): def test_SourceCode(self): """Test the SourceCode() method.""" env = Environment(FOO='mmm', BAR='nnn') - e = env.SourceCode('foo', None) + e = env.SourceCode('foo', None)[0] assert e.path == 'foo' s = e.src_builder() assert s is None, s b = Builder() - e = env.SourceCode(e, b) + e = env.SourceCode(e, b)[0] assert e.path == 'foo' s = e.src_builder() assert s is b, s - e = env.SourceCode('$BAR$FOO', None) + e = env.SourceCode('$BAR$FOO', None)[0] assert e.path == 'nnnmmm' s = e.src_builder() assert s is None, s diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 8087136..3aac882 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -268,7 +268,7 @@ class SConf: source = self.confdir.File(f + extension) sourceNode = self.env.SConfSourceBuilder(target=source, source=None) - nodesToBeBuilt.append(sourceNode) + nodesToBeBuilt.extend(sourceNode) else: source = None @@ -335,7 +335,7 @@ class SConf: pname = str(prog) output = SConfFS.File(pname+'.out') node = self.env.Command(output, prog, [ [ pname, ">", "${TARGET}"] ]) - ok = self.BuildNodes([node]) + ok = self.BuildNodes(node) if ok: outputStr = output.get_contents() return( 1, outputStr) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 261d73c..25cea2f 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -953,6 +953,19 @@ else: def is_String(e): return type(e) is types.StringType or isinstance(e, UserString) +def is_Scalar(e): + return is_String(e) or not is_List(e) + +def flatten(sequence, scalarp=is_Scalar, result=None): + if result is None: + result = [] + for item in sequence: + if scalarp(item): + result.append(item) + else: + flatten(item, scalarp, result) + return result + class Proxy: """A simple generic Proxy class, forwarding all calls to subject. So, for the benefit of the python newbie, what does diff --git a/test/BitKeeper.py b/test/BitKeeper.py index 4d703ab..73cd47f 100644 --- a/test/BitKeeper.py +++ b/test/BitKeeper.py @@ -123,17 +123,17 @@ bk get -e sub/SConscript """, build_str = """\ bk get -e aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) bk get -e ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) bk get -e sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) bk get -e sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """), stderr = """\ sub/SConscript 1.1 -> 1.2: 5 lines @@ -143,7 +143,7 @@ sub/ddd.in 1.1 -> 1.2: 1 lines sub/fff.in 1.1 -> 1.2: 1 lines """) - test.fail_test(test.read(['work1', 'all']) != "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") + test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") test.fail_test(not is_writable(test.workpath('work1', 'sub', 'SConscript'))) test.fail_test(not is_writable(test.workpath('work1', 'aaa.in'))) @@ -224,22 +224,22 @@ bk co -q sub/SConscript """, build_str = """\ bk co -q aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) bk co -q ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) bk co -q sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) bk co -q sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """)) - test.fail_test(test.read(['work2', 'all']) != "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") + test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") - test.fail_test(test.read(['work2', 'sub', 'all']) != "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n") + test.must_match(['work2', 'sub', 'all'], "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n") test.fail_test(is_writable(test.workpath('work2', 'sub', 'SConscript'))) test.fail_test(is_writable(test.workpath('work2', 'aaa.in'))) @@ -319,17 +319,17 @@ test.run(chdir = 'work3', """ % bk, build_str = """\ %s get aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) %s get ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) %s get sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) %s get sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """ % (bk, bk, bk, bk)), stderr = """\ sub/SConscript 1.1: 5 lines @@ -339,9 +339,9 @@ sub/ddd.in 1.1: 1 lines sub/fff.in 1.1: 1 lines """) -test.fail_test(test.read(['work3', 'all']) != "import/aaa.in\nwork3/bbb.in\nimport/ccc.in\n") +test.must_match(['work3', 'all'], "import/aaa.in\nwork3/bbb.in\nimport/ccc.in\n") -test.fail_test(test.read(['work3', 'sub', 'all']) != "import/sub/ddd.in\nwork3/sub/eee.in\nimport/sub/fff.in\n") +test.must_match(['work3', 'sub', 'all'], "import/sub/ddd.in\nwork3/sub/eee.in\nimport/sub/fff.in\n") test.fail_test(is_writable(test.workpath('work3', 'sub', 'SConscript'))) test.fail_test(is_writable(test.workpath('work3', 'aaa.in'))) diff --git a/test/CVS.py b/test/CVS.py index 25d87e5..0e9decc 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -127,17 +127,17 @@ cvs -Q -d %s co foo/sub/SConscript """ % (cvsroot), build_str = """\ cvs -Q -d %s co foo/aaa.in -cat("aaa.out", "%s") -cat("bbb.out", "%s") +cat(["aaa.out"], ["%s"]) +cat(["bbb.out"], ["%s"]) cvs -Q -d %s co foo/ccc.in -cat("ccc.out", "%s") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["%s"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) cvs -Q -d %s co foo/sub/ddd.in -cat("%s", "%s") -cat("%s", "%s") +cat(["%s"], ["%s"]) +cat(["%s"], ["%s"]) cvs -Q -d %s co foo/sub/fff.in -cat("%s", "%s") -cat("%s", ["%s", "%s", "%s"]) +cat(["%s"], ["%s"]) +cat(["%s"], ["%s", "%s", "%s"]) """ % (cvsroot, foo_aaa_in, foo_bbb_in, @@ -198,20 +198,20 @@ U sub/SConscript build_str = """\ cvs -q -d %s co -d . foo/aaa.in U ./aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) cvs -q -d %s co -d . foo/ccc.in U ./ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) cvs -q -d %s co -d sub foo/sub/ddd.in U sub/ddd.in -cat("%s", "%s") -cat("%s", "%s") +cat(["%s"], ["%s"]) +cat(["%s"], ["%s"]) cvs -q -d %s co -d sub foo/sub/fff.in U sub/fff.in -cat("%s", "%s") -cat("%s", ["%s", "%s", "%s"]) +cat(["%s"], ["%s"]) +cat(["%s"], ["%s", "%s", "%s"]) """ % (cvsroot, cvsroot, cvsroot, @@ -267,14 +267,14 @@ test.run(chdir = 'work3', stdout = test.wrap_stdout(build_str = """\ cvs -q -d %s co -d . foo/aaa.in U ./aaa.in -cat("aaa.out", "aaa.in") +cat(["aaa.out"], ["aaa.in"]) cvs -q -d %s co -d . foo/bbb.in U ./bbb.in -cat("bbb.out", "bbb.in") +cat(["bbb.out"], ["bbb.in"]) cvs -q -d %s co -d . foo/ccc.in U ./ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """ % (cvsroot, cvsroot, cvsroot))) @@ -301,7 +301,7 @@ env.Install('install', 'scons/SConstruct') test.run(chdir = 'work4', arguments = '.') -test.fail_test(not os.path.exists(test.workpath('work4', 'install', 'SConstruct'))) +test.must_exist(test.workpath('work4', 'install', 'SConstruct')) test.pass_test() diff --git a/test/CacheDir.py b/test/CacheDir.py index abb4bad..ae3f76e 100644 --- a/test/CacheDir.py +++ b/test/CacheDir.py @@ -69,8 +69,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n") # This should populate the cache with our derived files. test.run(chdir = 'src', arguments = '.') -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n") +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") test.up_to_date(chdir = 'src', arguments = '.') @@ -86,7 +86,7 @@ Retrieved `ccc.out' from cache Retrieved `all' from cache """)) -test.fail_test(os.path.exists(test.workpath('src', 'cat.out'))) +test.must_not_exist(test.workpath('src', 'cat.out')) test.up_to_date(chdir = 'src', arguments = '.') @@ -101,17 +101,17 @@ Retrieved `ccc.out' from cache Retrieved `all' from cache """)) -test.fail_test(os.path.exists(test.workpath('src', 'aaa.out'))) -test.fail_test(os.path.exists(test.workpath('src', 'bbb.out'))) -test.fail_test(os.path.exists(test.workpath('src', 'ccc.out'))) -test.fail_test(os.path.exists(test.workpath('src', 'all'))) +test.must_not_exist(test.workpath('src', 'aaa.out')) +test.must_not_exist(test.workpath('src', 'bbb.out')) +test.must_not_exist(test.workpath('src', 'ccc.out')) +test.must_not_exist(test.workpath('src', 'all')) # Verify that rebuilding with -s retrieves everything from the cache # even though it doesn't report anything. test.run(chdir = 'src', arguments = '-s .', stdout = "") -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(os.path.exists(test.workpath('src', 'cat.out'))) +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_not_exist(test.workpath('src', 'cat.out')) test.up_to_date(chdir = 'src', arguments = '.') @@ -123,13 +123,13 @@ test.write(['src', 'bbb.in'], "bbb.in 2\n") test.run(chdir = 'src', arguments = '.', stdout = test.wrap_stdout("""\ Retrieved `aaa.out' from cache -cat("bbb.out", "bbb.in") +cat(["bbb.out"], ["bbb.in"]) Retrieved `ccc.out' from cache -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """)) -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in 2\nccc.in\n") -test.fail_test(test.read(['src', 'cat.out']) != "bbb.out\nall\n") +test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n") +test.must_match(['src', 'cat.out'], "bbb.out\nall\n") test.up_to_date(chdir = 'src', arguments = '.') @@ -162,8 +162,8 @@ SConscript('build/SConscript') # This should populate the cache with our derived files. test.run() -test.fail_test(test.read(['build', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read('cat.out') != "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all)) +test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match('cat.out', "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all)) test.up_to_date(arguments = '.') @@ -179,7 +179,7 @@ Retrieved `%s' from cache Retrieved `%s' from cache """ % (build_aaa_out, build_bbb_out, build_ccc_out, build_all))) -test.fail_test(os.path.exists(test.workpath('cat.out'))) +test.must_not_exist(test.workpath('cat.out')) test.up_to_date(arguments = '.') @@ -194,17 +194,17 @@ Retrieved `%s' from cache Retrieved `%s' from cache """ % (build_aaa_out, build_bbb_out, build_ccc_out, build_all))) -test.fail_test(os.path.exists(test.workpath('build', 'aaa.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'bbb.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'ccc.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'all'))) +test.must_not_exist(test.workpath('build', 'aaa.out')) +test.must_not_exist(test.workpath('build', 'bbb.out')) +test.must_not_exist(test.workpath('build', 'ccc.out')) +test.must_not_exist(test.workpath('build', 'all')) # Verify that rebuilding with -s retrieves everything from the cache # even though it doesn't report anything. test.run(arguments = '-s .', stdout = "") -test.fail_test(test.read(['build', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(os.path.exists(test.workpath('cat.out'))) +test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_not_exist(test.workpath('cat.out')) test.up_to_date(arguments = '.') @@ -216,16 +216,16 @@ test.write(['src', 'bbb.in'], "bbb.in 2\n") test.run(stdout = test.wrap_stdout("""\ Retrieved `%s' from cache -cat("%s", "%s") +cat(["%s"], ["%s"]) Retrieved `%s' from cache -cat("%s", ["%s", "%s", "%s"]) +cat(["%s"], ["%s", "%s", "%s"]) """ % (build_aaa_out, build_bbb_out, os.path.join('src', 'bbb.in'), build_ccc_out, build_all, build_aaa_out, build_bbb_out, build_ccc_out))) -test.fail_test(test.read(['build', 'all']) != "aaa.in\nbbb.in 2\nccc.in\n") -test.fail_test(test.read('cat.out') != "%s\n%s\n" % (build_bbb_out, build_all)) +test.must_match(['build', 'all'], "aaa.in\nbbb.in 2\nccc.in\n") +test.must_match('cat.out', "%s\n%s\n" % (build_bbb_out, build_all)) test.up_to_date(arguments = '.') @@ -270,7 +270,7 @@ test.write(['subdir', 'file.ma'], "subdir/file.ma\n") test.run(chdir = 'subdir') -test.fail_test(os.path.exists(test.workpath('cache3', 'N', 'None'))) +test.must_not_exist(test.workpath('cache3', 'N', 'None')) ############################################################################# # Test that multiple target files get retrieved from cache correctly. @@ -290,18 +290,18 @@ test.write(['multiple', 'input'], "multiple/input\n") test.run(chdir = 'multiple') -test.fail_test(not os.path.exists(test.workpath('multiple', 'foo'))) -test.fail_test(not os.path.exists(test.workpath('multiple', 'bar'))) +test.must_exist(test.workpath('multiple', 'foo')) +test.must_exist(test.workpath('multiple', 'bar')) test.run(chdir = 'multiple', arguments = '-c') -test.fail_test(os.path.exists(test.workpath('multiple', 'foo'))) -test.fail_test(os.path.exists(test.workpath('multiple', 'bar'))) +test.must_not_exist(test.workpath('multiple', 'foo')) +test.must_not_exist(test.workpath('multiple', 'bar')) test.run(chdir = 'multiple') -test.fail_test(not os.path.exists(test.workpath('multiple', 'foo'))) -test.fail_test(not os.path.exists(test.workpath('multiple', 'bar'))) +test.must_exist(test.workpath('multiple', 'foo')) +test.must_exist(test.workpath('multiple', 'bar')) # All done. test.pass_test() diff --git a/test/Chmod.py b/test/Chmod.py index d0929dc..45245f2 100644 --- a/test/Chmod.py +++ b/test/Chmod.py @@ -84,12 +84,12 @@ os.chmod(test.workpath('f7.out-Chmod'), 0444) expect = test.wrap_stdout(read_str = 'Chmod("f1", 0666)\nChmod("d2", 0777)\n', build_str = """\ -cat("bar.out", "bar.in") +cat(["bar.out"], ["bar.in"]) Chmod("f3", 0666) Chmod("d4", 0777) Chmod("f5", 0666) -cat("f6.out", "f6.in") -cat("f7.out", "f7.in") +cat(["f6.out"], ["f6.in"]) +cat(["f7.out"], ["f7.in"]) Chmod("Chmod-f7.in", 0666) Chmod("f7.out-Chmod", 0666) """) diff --git a/test/Copy.py b/test/Copy.py index 00642da..b318e58 100644 --- a/test/Copy.py +++ b/test/Copy.py @@ -77,13 +77,13 @@ Copy("d2.out", "d2.in") Copy("d3.out", "f3.in") """, build_str = """\ -cat("bar.out", "bar.in") +cat(["bar.out"], ["bar.in"]) Copy("f4.out", "f4.in") Copy("d5.out", "d5.in") Copy("d6.out", "f6.in") Copy("f7.out", "f7.in") -cat("f8.out", "f8.in") -cat("f9.out", "f9.in") +cat(["f8.out"], ["f8.in"]) +cat(["f9.out"], ["f9.in"]) Copy("f9.out-Copy", "f9.in") """) test.run(options = '-n', arguments = '.', stdout = expect) diff --git a/test/Delete.py b/test/Delete.py index ece9aa8..4f69c5f 100644 --- a/test/Delete.py +++ b/test/Delete.py @@ -74,13 +74,13 @@ Delete("f1") Delete("d2") """, build_str = """\ -cat("f3.out", "f3.in") +cat(["f3.out"], ["f3.in"]) Delete("f4") Delete("d5") Delete("f6") Delete("d7") -cat("f8.out", "f8.in") -cat("f9.out", "f9.in") +cat(["f8.out"], ["f8.in"]) +cat(["f9.out"], ["f9.in"]) Delete("Delete-f9.in") Delete("f9.out-Delete") """) diff --git a/test/Depends.py b/test/Depends.py index a7d1bdf..284d6f7 100644 --- a/test/Depends.py +++ b/test/Depends.py @@ -78,13 +78,12 @@ test.write(['subdir', 'bar.dep'], "subdir/bar.dep 1\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 1\n") -test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 1\n") -test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\nsubdir/bar.dep 1\n") -test.fail_test(test.read(['subdir', 'f4.out']) != - "subdir/f4.in\nsubdir/bar.dep 1\n") -test.fail_test(test.read('f5.out') != "f5.in\nsubdir/foo.dep 1\n") -test.fail_test(test.read(['sub2', 'f6.out']) != "f6.in\nsubdir/bar.dep 1\n") +test.must_match('f1.out', "f1.in\nsubdir/foo.dep 1\n") +test.must_match('f2.out', "f2.in\nsubdir/foo.dep 1\n") +test.must_match(['subdir', 'f3.out'], "f3.in\nsubdir/bar.dep 1\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\nsubdir/bar.dep 1\n") +test.must_match('f5.out', "f5.in\nsubdir/foo.dep 1\n") +test.must_match(['sub2', 'f6.out'], "f6.in\nsubdir/bar.dep 1\n") # test.write(['subdir', 'foo.dep'], "subdir/foo.dep 2\n") @@ -93,52 +92,48 @@ test.write('f6.in', "f6.in 2\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 2\n") -test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 2\n") -test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\nsubdir/bar.dep 2\n") -test.fail_test(test.read(['subdir', 'f4.out']) != - "subdir/f4.in\nsubdir/bar.dep 2\n") -test.fail_test(test.read('f5.out') != "f5.in\nsubdir/foo.dep 2\n") -test.fail_test(test.read(['sub2', 'f6.out']) != "f6.in 2\nsubdir/bar.dep 2\n") +test.must_match('f1.out', "f1.in\nsubdir/foo.dep 2\n") +test.must_match('f2.out', "f2.in\nsubdir/foo.dep 2\n") +test.must_match(['subdir', 'f3.out'], "f3.in\nsubdir/bar.dep 2\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\nsubdir/bar.dep 2\n") +test.must_match('f5.out', "f5.in\nsubdir/foo.dep 2\n") +test.must_match(['sub2', 'f6.out'], "f6.in 2\nsubdir/bar.dep 2\n") # test.write(['subdir', 'foo.dep'], "subdir/foo.dep 3\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\nsubdir/bar.dep 2\n") -test.fail_test(test.read(['subdir', 'f4.out']) != - "subdir/f4.in\nsubdir/bar.dep 2\n") -test.fail_test(test.read('f5.out') != "f5.in\nsubdir/foo.dep 2\n") -test.fail_test(test.read(['sub2', 'f6.out']) != "f6.in 2\nsubdir/bar.dep 2\n") +test.must_match('f1.out', "f1.in\nsubdir/foo.dep 3\n") +test.must_match('f2.out', "f2.in\nsubdir/foo.dep 3\n") +test.must_match(['subdir', 'f3.out'], "f3.in\nsubdir/bar.dep 2\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\nsubdir/bar.dep 2\n") +test.must_match('f5.out', "f5.in\nsubdir/foo.dep 2\n") +test.must_match(['sub2', 'f6.out'], "f6.in 2\nsubdir/bar.dep 2\n") # test.write(['subdir', 'bar.dep'], "subdir/bar.dep 3\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\nsubdir/bar.dep 3\n") -test.fail_test(test.read(['subdir', 'f4.out']) != - "subdir/f4.in\nsubdir/bar.dep 3\n") -test.fail_test(test.read('f5.out') != "f5.in\nsubdir/foo.dep 2\n") -test.fail_test(test.read(['sub2', 'f6.out']) != "f6.in 2\nsubdir/bar.dep 2\n") +test.must_match('f1.out', "f1.in\nsubdir/foo.dep 3\n") +test.must_match('f2.out', "f2.in\nsubdir/foo.dep 3\n") +test.must_match(['subdir', 'f3.out'], "f3.in\nsubdir/bar.dep 3\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\nsubdir/bar.dep 3\n") +test.must_match('f5.out', "f5.in\nsubdir/foo.dep 2\n") +test.must_match(['sub2', 'f6.out'], "f6.in 2\nsubdir/bar.dep 2\n") # test.write('f6.in', "f6.in 3\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read('f2.out') != "f2.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read(['subdir', 'f3.out']) != "f3.in\nsubdir/bar.dep 3\n") -test.fail_test(test.read(['subdir', 'f4.out']) != - "subdir/f4.in\nsubdir/bar.dep 3\n") -test.fail_test(test.read('f5.out') != "f5.in\nsubdir/foo.dep 3\n") -test.fail_test(test.read(['sub2', 'f6.out']) != "f6.in 3\nsubdir/bar.dep 3\n") +test.must_match('f1.out', "f1.in\nsubdir/foo.dep 3\n") +test.must_match('f2.out', "f2.in\nsubdir/foo.dep 3\n") +test.must_match(['subdir', 'f3.out'], "f3.in\nsubdir/bar.dep 3\n") +test.must_match(['subdir', 'f4.out'], "subdir/f4.in\nsubdir/bar.dep 3\n") +test.must_match('f5.out', "f5.in\nsubdir/foo.dep 3\n") +test.must_match(['sub2', 'f6.out'], "f6.in 3\nsubdir/bar.dep 3\n") # test.write('SConstruct', """\ @@ -148,10 +143,6 @@ file2 = File('file2') env.Depends(file1, [[file2, 'file3']]) """) -test.run(status = 2, stderr = """ -scons: *** attempted to add a non-Node dependency to file1: -\t['file2', 'file3'] is a <type 'list'>, not a Node -File "SConstruct", line 4, in ? -""") +test.up_to_date(arguments = '.') test.pass_test() diff --git a/test/Environment.py b/test/Environment.py index b315c40..9851db7 100644 --- a/test/Environment.py +++ b/test/Environment.py @@ -37,6 +37,7 @@ target = env.Command('foo.out', 'foo.in', r'%s build.py $SOURCE $TARGET ${File(BAR)} ${Dir(BLAT)}') +target = target[0] assert target == Dir('.').File('foo.out') assert Dir('.') == Dir('.').Dir('.') assert target == target.File('foo.out') diff --git a/test/Exit.py b/test/Exit.py index 42ae777..570b6db 100644 --- a/test/Exit.py +++ b/test/Exit.py @@ -118,13 +118,13 @@ test.write(['subdir', 'foo.in'], "subdir/foo.in\n") test.run(status = 27, stdout = test.wrap_stdout("""\ -exit_builder("%s", "%s") +exit_builder(["%s"], ["%s"]) """ % (subdir_foo_out, subdir_foo_in), error=1), stderr = """\ scons: *** [%s] Explicit exit, status 27 """ % (subdir_foo_out)) -test.fail_test(test.read(['subdir', 'foo.out']) != "subdir/foo.in\n") +test.must_match(['subdir', 'foo.out'], "subdir/foo.in\n") test.write('SConstruct', """\ def exit_scanner(node, env, target): diff --git a/test/Ignore.py b/test/Ignore.py index 06db727..1652f60 100644 --- a/test/Ignore.py +++ b/test/Ignore.py @@ -74,11 +74,9 @@ test.write(['subdir', 'f3b.in'], "subdir/f3b.in\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1a.in\nf1b.in\n") -test.fail_test(test.read(['subdir', 'f2.out']) != - "subdir/f2a.in\nsubdir/f2b.in\n") -test.fail_test(test.read(['subdir', 'f3.out']) != - "subdir/f3a.in\nsubdir/f3b.in\n") +test.must_match('f1.out', "f1a.in\nf1b.in\n") +test.must_match(['subdir', 'f2.out'], "subdir/f2a.in\nsubdir/f2b.in\n") +test.must_match(['subdir', 'f3.out'], "subdir/f3a.in\nsubdir/f3b.in\n") test.up_to_date(arguments = '.') @@ -88,11 +86,9 @@ test.write(['subdir', 'f3b.in'], "subdir/f3b.in 2\n") test.up_to_date(arguments = '.') -test.fail_test(test.read('f1.out') != "f1a.in\nf1b.in\n") -test.fail_test(test.read(['subdir', 'f2.out']) != - "subdir/f2a.in\nsubdir/f2b.in\n") -test.fail_test(test.read(['subdir', 'f3.out']) != - "subdir/f3a.in\nsubdir/f3b.in\n") +test.must_match('f1.out', "f1a.in\nf1b.in\n") +test.must_match(['subdir', 'f2.out'], "subdir/f2a.in\nsubdir/f2b.in\n") +test.must_match(['subdir', 'f3.out'], "subdir/f3a.in\nsubdir/f3b.in\n") test.write('f1a.in', "f1a.in 2\n") test.write(['subdir', 'f2b.in'], "subdir/f2b.in 2\n") @@ -100,11 +96,9 @@ test.write(['subdir', 'f3a.in'], "subdir/f3a.in 2\n") test.run(arguments = '.') -test.fail_test(test.read('f1.out') != "f1a.in 2\nf1b.in 2\n") -test.fail_test(test.read(['subdir', 'f2.out']) != - "subdir/f2a.in 2\nsubdir/f2b.in 2\n") -test.fail_test(test.read(['subdir', 'f3.out']) != - "subdir/f3a.in 2\nsubdir/f3b.in 2\n") +test.must_match('f1.out', "f1a.in 2\nf1b.in 2\n") +test.must_match(['subdir', 'f2.out'], "subdir/f2a.in 2\nsubdir/f2b.in 2\n") +test.must_match(['subdir', 'f3.out'], "subdir/f3a.in 2\nsubdir/f3b.in 2\n") test.up_to_date(arguments = '.') @@ -116,10 +110,6 @@ file2 = File('file2') env.Ignore(file1, [[file2, 'file3']]) """) -test.run(status = 2, stderr = """ -scons: *** attempted to ignore a non-Node dependency of file1: -\t['file2', 'file3'] is a <type 'list'>, not a Node -File "SConstruct", line 4, in ? -""") +test.up_to_date(arguments = '.') test.pass_test() diff --git a/test/Mkdir.py b/test/Mkdir.py index e0ac3fd..cdbcd4b 100644 --- a/test/Mkdir.py +++ b/test/Mkdir.py @@ -59,11 +59,11 @@ test.write('f6.in', "f6.in\n") expect = test.wrap_stdout(read_str = 'Mkdir("d1")\n', build_str = """\ -cat("f2.out", "f2.in") +cat(["f2.out"], ["f2.in"]) Mkdir("d3") Mkdir("d4") -cat("f5.out", "f5.in") -cat("f6.out", "f6.in") +cat(["f5.out"], ["f5.in"]) +cat(["f6.out"], ["f6.in"]) Mkdir("Mkdir-f6.in") Mkdir("f6.out-Mkdir") """) diff --git a/test/Move.py b/test/Move.py index a1d9772..c1cdcfd 100644 --- a/test/Move.py +++ b/test/Move.py @@ -59,11 +59,11 @@ test.write('f6.in-Move', "f6.in-Move\n") expect = test.wrap_stdout(read_str = 'Move("f1.out", "f1.in")\n', build_str = """\ -cat("f2.out", "f2.in") +cat(["f2.out"], ["f2.in"]) Move("f3.out", "f3.in") Move("f4.out", "f4.in") -cat("f5.out", "f5.in") -cat("f6.out", "f6.in") +cat(["f5.out"], ["f5.in"]) +cat(["f6.out"], ["f6.in"]) Move("Move-f6.out", "f6.in-Move") """) test.run(options = '-n', arguments = '.', stdout = expect) diff --git a/test/Program.py b/test/Program.py index 91f391e..007a35b 100644 --- a/test/Program.py +++ b/test/Program.py @@ -44,7 +44,9 @@ test.write('SConstruct', """ env = Environment() env.Program(target = 'foo1', source = 'f1.c') env.Program(target = 'foo2', source = Split('f2a.c f2b.c f2c.c')) -Program(target = 'foo3', source = ['f3a.c', 'f3b.c', 'f3c.c']) +f3a = File('f3a.c') +f3b = File('f3b.c') +Program(target = 'foo3', source = [f3a, [f3b, 'f3c.c']]) env.Program('foo4', 'f4.c') env.Program('foo5.c') """) @@ -327,19 +329,4 @@ test.fail_test(not (oldtime3 == os.path.getmtime(foo3))) test.fail_test(not (oldtime4 == os.path.getmtime(foo4))) test.fail_test(not (oldtime5 == os.path.getmtime(foo5))) -# -test.write('SConstruct', """\ -file1 = File('file1.c') -file2 = File('file2.c') -Program('foo', [file1, [file2, 'file3.c']]) -""") - -foo_exe = 'foo'+_exe - -test.run(status = 2, stderr = """ -scons: *** attempted to add a non-Node as source of %s: -\t['file2.c', 'file3.c'] is a <type 'list'>, not a Node -File "SConstruct", line 3, in ? -""" % foo_exe) - test.pass_test() diff --git a/test/RCS.py b/test/RCS.py index 93a985e..15ad0f5 100644 --- a/test/RCS.py +++ b/test/RCS.py @@ -116,22 +116,22 @@ co -q sub/SConscript """, build_str = """\ co -q aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) co -q ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) co -q sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) co -q sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """)) -test.fail_test(test.read(['work1', 'all']) != "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") +test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") -test.fail_test(test.read(['work1', 'sub', 'all']) != "work1/sub/ddd.in\nchecked-out work1/sub/eee.in\nwork1/sub/fff.in\n") +test.must_match(['work1', 'sub', 'all'], "work1/sub/ddd.in\nchecked-out work1/sub/eee.in\nwork1/sub/fff.in\n") test.fail_test(is_writable(test.workpath('work1', 'sub', 'SConscript'))) test.fail_test(is_writable(test.workpath('work1', 'aaa.in'))) @@ -205,17 +205,17 @@ co -l sub/SConscript """, build_str = """\ co -l aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) co -l ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) co -l sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) co -l sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """), stderr = """\ sub/RCS/SConscript,v --> sub/SConscript @@ -235,9 +235,9 @@ revision 1.1 (locked) done """) -test.fail_test(test.read(['work2', 'all']) != "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") +test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") -test.fail_test(test.read(['work2', 'sub', 'all']) != "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n") +test.must_match(['work2', 'sub', 'all'], "work2/sub/ddd.in\nchecked-out work2/sub/eee.in\nwork2/sub/fff.in\n") test.fail_test(not is_writable(test.workpath('work2', 'sub', 'SConscript'))) test.fail_test(not is_writable(test.workpath('work2', 'aaa.in'))) diff --git a/test/SCCS.py b/test/SCCS.py index b98e9a7..52ee0db 100644 --- a/test/SCCS.py +++ b/test/SCCS.py @@ -104,17 +104,17 @@ sccs get -e sub/SConscript """, build_str = """\ sccs get -e aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) sccs get -e ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) sccs get -e sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) sccs get -e sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """), stderr = """\ sub/SConscript 1.1 -> 1.2: 5 lines @@ -124,7 +124,7 @@ sub/ddd.in 1.1 -> 1.2: 1 lines sub/fff.in 1.1 -> 1.2: 1 lines """) -test.fail_test(test.read(['work1', 'all']) != "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") +test.must_match(['work1', 'all'], "work1/aaa.in\nchecked-out work1/bbb.in\nwork1/ccc.in\n") test.fail_test(not is_writable(test.workpath('work1', 'sub', 'SConscript'))) test.fail_test(not is_writable(test.workpath('work1', 'aaa.in'))) @@ -191,17 +191,17 @@ sccs get sub/SConscript """, build_str = """\ sccs get aaa.in -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) sccs get ccc.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) sccs get sub/ddd.in -cat("sub/ddd.out", "sub/ddd.in") -cat("sub/eee.out", "sub/eee.in") +cat(["sub/ddd.out"], ["sub/ddd.in"]) +cat(["sub/eee.out"], ["sub/eee.in"]) sccs get sub/fff.in -cat("sub/fff.out", "sub/fff.in") -cat("sub/all", ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) +cat(["sub/fff.out"], ["sub/fff.in"]) +cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"]) """), stderr = """\ sub/SConscript 1.1: 5 lines @@ -211,7 +211,7 @@ sub/ddd.in 1.1: 1 lines sub/fff.in 1.1: 1 lines """) -test.fail_test(test.read(['work2', 'all']) != "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") +test.must_match(['work2', 'all'], "work2/aaa.in\nchecked-out work2/bbb.in\nwork2/ccc.in\n") test.fail_test(is_writable(test.workpath('work2', 'sub', 'SConscript'))) test.fail_test(is_writable(test.workpath('work2', 'aaa.in'))) diff --git a/test/Scanner.py b/test/Scanner.py index 0bb3d8b..e1d5237 100644 --- a/test/Scanner.py +++ b/test/Scanner.py @@ -92,7 +92,7 @@ env2.Append(SCANNERS = [k2scan]) env2.Command('junk', 'junk.k2', r'%s build.py $SOURCES $TARGET') bar = env.Command('bar', 'bar.in', r'%s build.py $SOURCES $TARGET') -bar.source_scanner = kscan +bar[0].source_scanner = kscan """ % (python, python, python)) test.write('foo.k', diff --git a/test/SetBuildSignatureType.py b/test/SetBuildSignatureType.py index 3449304..69073b6 100644 --- a/test/SetBuildSignatureType.py +++ b/test/SetBuildSignatureType.py @@ -57,8 +57,8 @@ test.write('foo.in', 'foo.in') test.run(arguments='foo.out.out', stdout=test.wrap_stdout("""\ -copy2("foo.out", "foo.in") -copy1("foo.out.out", "foo.out") +copy2(["foo.out"], ["foo.in"]) +copy1(["foo.out.out"], ["foo.out"]) """), stderr=warning%16) @@ -87,7 +87,7 @@ SetBuildSignatureType('content') test.run(arguments='foo.out.out', stdout=test.wrap_stdout("""\ -copy2("foo.out", "foo.in") +copy2(["foo.out"], ["foo.in"]) scons: `foo.out.out' is up to date. """), stderr=warning%17) @@ -113,7 +113,7 @@ SetBuildSignatureType('build') test.run(arguments='foo.out.out', stdout=test.wrap_stdout("""\ -copy1("foo.out.out", "foo.out") +copy1(["foo.out.out"], ["foo.out"]) """), stderr=warning%17) @@ -137,8 +137,8 @@ SetBuildSignatureType('build') test.run(arguments='foo.out.out', stdout=test.wrap_stdout("""\ -copy2("foo.out", "foo.in") -copy1("foo.out.out", "foo.out") +copy2(["foo.out"], ["foo.in"]) +copy1(["foo.out.out"], ["foo.out"]) """), stderr=warning%16) diff --git a/test/SetContentSignatureType.py b/test/SetContentSignatureType.py index 586d55b..a6f6be2 100644 --- a/test/SetContentSignatureType.py +++ b/test/SetContentSignatureType.py @@ -63,9 +63,9 @@ test.run(arguments = 'f1.out f3.out', test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ scons: `f1.out' is up to date. -build("f2.out", "f2.in") +build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. -build("f4.out", "f4.in") +build(["f4.out"], ["f4.in"]) """), stderr = warning%11) @@ -78,9 +78,9 @@ os.utime(test.workpath('f3.in'), test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ -build("f1.out", "f1.in") +build(["f1.out"], ["f1.in"]) scons: `f2.out' is up to date. -build("f3.out", "f3.in") +build(["f3.out"], ["f3.in"]) scons: `f4.out' is up to date. """), stderr = warning%11) @@ -109,9 +109,9 @@ test.run(arguments = 'f1.out f3.out', test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ scons: `f1.out' is up to date. -build("f2.out", "f2.in") +build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. -build("f4.out", "f4.in") +build(["f4.out"], ["f4.in"]) """), stderr = warning%11) diff --git a/test/SideEffect.py b/test/SideEffect.py index 35241bc..f7533b5 100644 --- a/test/SideEffect.py +++ b/test/SideEffect.py @@ -60,8 +60,8 @@ test.write('blat.in', 'blat.in\n') test.write('baz.in', 'baz.in\n') test.run(arguments = 'foo.out bar.out', stdout=test.wrap_stdout("""\ -build("foo.out", "foo.in") -build("bar.out", "bar.in") +build(["foo.out"], ["foo.in"]) +build(["bar.out"], ["bar.in"]) """)) expect = """\ @@ -73,8 +73,8 @@ assert test.read('log.txt') == expect test.write('bar.in', 'bar.in 2 \n') test.run(arguments = 'log.txt', stdout=test.wrap_stdout("""\ -build("bar.out", "bar.in") -build("blat.out", "blat.in") +build(["bar.out"], ["bar.in"]) +build(["blat.out"], ["blat.in"]) """)) expect = """\ @@ -88,10 +88,10 @@ assert test.read('log.txt') == expect test.write('foo.in', 'foo.in 2 \n') test.run(arguments = ".", stdout=test.wrap_stdout("""\ -build("foo.out", "foo.in") -build("log.out", "log.txt") -build("%s", "baz.in") -build("%s", "%s") +build(["foo.out"], ["foo.in"]) +build(["log.out"], ["log.txt"]) +build(["%s"], ["baz.in"]) +build(["%s"], ["%s"]) """ % (os.path.join('subdir', 'baz.out'), os.path.join('subdir', 'out.out'), os.path.join('subdir', 'out.txt')))) @@ -107,18 +107,18 @@ assert test.read('log.txt') == expect test.run(arguments = "-c .") -test.fail_test(os.path.exists(test.workpath('foo.out'))) -test.fail_test(os.path.exists(test.workpath('bar.out'))) -test.fail_test(os.path.exists(test.workpath('blat.out'))) -test.fail_test(os.path.exists(test.workpath('log.txt'))) +test.must_not_exist(test.workpath('foo.out')) +test.must_not_exist(test.workpath('bar.out')) +test.must_not_exist(test.workpath('blat.out')) +test.must_not_exist(test.workpath('log.txt')) build_lines = [ - 'build("bar.out", "bar.in")', - 'build("blat.out", "blat.in")', - 'build("foo.out", "foo.in")', - 'build("log.out", "log.txt")', - 'build("%s", "baz.in")' % os.path.join('subdir', 'baz.out'), - 'build("%s", "%s")' % (os.path.join('subdir', 'out.out'), + 'build(["bar.out"], ["bar.in"])', + 'build(["blat.out"], ["blat.in"])', + 'build(["foo.out"], ["foo.in"])', + 'build(["log.out"], ["log.txt"])', + 'build(["%s"], ["baz.in"])' % os.path.join('subdir', 'baz.out'), + 'build(["%s"], ["%s"])' % (os.path.join('subdir', 'out.out'), os.path.join('subdir', 'out.txt')), ] test.run(arguments = "-j 4 .") @@ -160,14 +160,14 @@ env.SideEffect(Dir('log'), ['foo.out', 'bar.out', 'blat.out']) test.run(arguments='foo.out') -test.fail_test(not os.path.exists(test.workpath('foo.out'))) -test.fail_test(not os.path.exists(test.workpath('log/foo.out'))) -test.fail_test(os.path.exists(test.workpath('log', 'bar.out'))) -test.fail_test(os.path.exists(test.workpath('log', 'blat.out'))) +test.must_exist(test.workpath('foo.out')) +test.must_exist(test.workpath('log/foo.out')) +test.must_not_exist(test.workpath('log', 'bar.out')) +test.must_not_exist(test.workpath('log', 'blat.out')) test.run(arguments='log') -test.fail_test(not os.path.exists(test.workpath('log', 'bar.out'))) -test.fail_test(not os.path.exists(test.workpath('log', 'blat.out'))) +test.must_exist(test.workpath('log', 'bar.out')) +test.must_exist(test.workpath('log', 'blat.out')) test.write('SConstruct', """ diff --git a/test/SourceCode.py b/test/SourceCode.py index de2653f..ea18004 100644 --- a/test/SourceCode.py +++ b/test/SourceCode.py @@ -76,18 +76,18 @@ test.write(['sub', 'sc-SConscript'], "'sub/sc-SConscript'\n") test.run(arguments = '.', stdout = test.wrap_stdout(read_str = """\ -sc_cat("%s", []) +sc_cat(["%s"], []) """ % (os.path.join('sub', 'SConscript')), build_str = """\ -sc_cat("%s", []) -cat("aaa.out", "%s") -sc_cat("%s", []) -cat("bbb.out", "%s") -sc_cat("%s", []) -cat("ccc.out", "%s") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) -sc_cat("%s", []) -cat("ddd.out", "%s") +sc_cat(["%s"], []) +cat(["aaa.out"], ["%s"]) +sc_cat(["%s"], []) +cat(["bbb.out"], ["%s"]) +sc_cat(["%s"], []) +cat(["ccc.out"], ["%s"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) +sc_cat(["%s"], []) +cat(["ddd.out"], ["%s"]) """ % (os.path.join('sub', 'aaa.in'), os.path.join('sub', 'aaa.in'), os.path.join('sub', 'bbb.in'), @@ -97,8 +97,8 @@ cat("ddd.out", "%s") os.path.join('sub2', 'ddd.in'), os.path.join('sub2', 'ddd.in')))) -test.fail_test(test.read(['sub', 'SConscript']) != "'sub/sc-SConscript'\n") -test.fail_test(test.read('all') != "sub/sc-aaa.in\nsub/sc-bbb.in\nsub/sc-ccc.in\n") -test.fail_test(test.read('ddd.out') != "sub2/sc-ddd.in\n") +test.must_match(['sub', 'SConscript'], "'sub/sc-SConscript'\n") +test.must_match('all', "sub/sc-aaa.in\nsub/sc-bbb.in\nsub/sc-ccc.in\n") +test.must_match('ddd.out', "sub2/sc-ddd.in\n") test.pass_test() diff --git a/test/SourceSignatures.py b/test/SourceSignatures.py index 10dfb29..36a9195 100644 --- a/test/SourceSignatures.py +++ b/test/SourceSignatures.py @@ -56,9 +56,9 @@ test.run(arguments = 'f1.out f3.out') test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ scons: `f1.out' is up to date. -build("f2.out", "f2.in") +build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. -build("f4.out", "f4.in") +build(["f4.out"], ["f4.in"]) """)) os.utime(test.workpath('f1.in'), @@ -70,9 +70,9 @@ os.utime(test.workpath('f3.in'), test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ -build("f1.out", "f1.in") +build(["f1.out"], ["f1.in"]) scons: `f2.out' is up to date. -build("f3.out", "f3.in") +build(["f3.out"], ["f3.in"]) scons: `f4.out' is up to date. """)) @@ -99,9 +99,9 @@ test.run(arguments = 'f1.out f3.out') test.run(arguments = 'f1.out f2.out f3.out f4.out', stdout = test.wrap_stdout("""\ scons: `f1.out' is up to date. -build("f2.out", "f2.in") +build(["f2.out"], ["f2.in"]) scons: `f3.out' is up to date. -build("f4.out", "f4.in") +build(["f4.out"], ["f4.in"]) """)) os.utime(test.workpath('f1.in'), @@ -151,9 +151,9 @@ test.run(arguments = 'f5.out f7.out') test.run(arguments = 'f5.out f6.out f7.out f8.out', stdout = test.wrap_stdout("""\ scons: `f5.out' is up to date. -build("f6.out", "f6.in") +build(["f6.out"], ["f6.in"]) scons: `f7.out' is up to date. -build("f8.out", "f8.in") +build(["f8.out"], ["f8.in"]) """)) os.utime(test.workpath('f5.in'), @@ -165,7 +165,7 @@ os.utime(test.workpath('f7.in'), test.run(arguments = 'f5.out f6.out f7.out f8.out', stdout = test.wrap_stdout("""\ -build("f5.out", "f5.in") +build(["f5.out"], ["f5.in"]) scons: `f6.out' is up to date. scons: `f7.out' is up to date. scons: `f8.out' is up to date. @@ -186,10 +186,9 @@ env.B(target = 'switch.out', source = 'switch.in') test.write('switch.in', "switch.in\n") -test.run(arguments = 'switch.out', - stdout = test.wrap_stdout("""\ -build("switch.out", "switch.in") -""")) +switch_out_switch_in = test.wrap_stdout('build(["switch.out"], ["switch.in"])\n') + +test.run(arguments = 'switch.out', stdout = switch_out_switch_in) test.up_to_date(arguments = 'switch.out') @@ -203,10 +202,7 @@ env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'switch.out', source = 'switch.in') """) -test.run(arguments = 'switch.out', - stdout = test.wrap_stdout("""\ -build("switch.out", "switch.in") -""")) +test.run(arguments = 'switch.out', stdout = switch_out_switch_in) test.up_to_date(arguments = 'switch.out') @@ -220,19 +216,13 @@ env = Environment(BUILDERS = { 'B' : B }) env.B(target = 'switch.out', source = 'switch.in') """) -test.run(arguments = 'switch.out', - stdout = test.wrap_stdout("""\ -build("switch.out", "switch.in") -""")) +test.run(arguments = 'switch.out', stdout = switch_out_switch_in) test.up_to_date(arguments = 'switch.out') test.write('switch.in', "switch.in 2\n") -test.run(arguments = 'switch.out', - stdout = test.wrap_stdout("""\ -build("switch.out", "switch.in") -""")) +test.run(arguments = 'switch.out', stdout = switch_out_switch_in) # Test both implicit_cache and timestamp signatures at the same time: @@ -249,41 +239,30 @@ env.B(target = 'both.out', source = 'both.in') test.write('both.in', "both.in 1\n") -test.run(arguments = 'both.out', - stdout = test.wrap_stdout("""\ -build("both.out", "both.in") -""")) +both_out_both_in = test.wrap_stdout('build(["both.out"], ["both.in"])\n') + +test.run(arguments = 'both.out', stdout = both_out_both_in) time.sleep(2) test.write('both.in', "both.in 2\n") -test.run(arguments = 'both.out', - stdout = test.wrap_stdout("""\ -build("both.out", "both.in") -""")) +test.run(arguments = 'both.out', stdout = both_out_both_in) time.sleep(2) test.write('both.in', "both.in 3\n") -test.run(arguments = 'both.out', - stdout = test.wrap_stdout("""\ -build("both.out", "both.in") -""")) +test.run(arguments = 'both.out', stdout = both_out_both_in) time.sleep(2) test.write('both.in', "both.in 4\n") -test.run(arguments = 'both.out', - stdout = test.wrap_stdout("""\ -build("both.out", "both.in") -""")) +test.run(arguments = 'both.out', stdout = both_out_both_in) time.sleep(2) - test.up_to_date(arguments = 'both.out') test.pass_test() diff --git a/test/TargetSignatures.py b/test/TargetSignatures.py index 2ee016e..11dee8a 100644 --- a/test/TargetSignatures.py +++ b/test/TargetSignatures.py @@ -56,10 +56,10 @@ test.write('bar.in', 'bar.in') test.run(arguments="bar.out foo.out", stdout=test.wrap_stdout("""\ -copy2("bar.mid", "bar.in") -copy1("bar.out", "bar.mid") -copy2("foo.mid", "foo.in") -copy1("foo.out", "foo.mid") +copy2(["bar.mid"], ["bar.in"]) +copy1(["bar.out"], ["bar.mid"]) +copy2(["foo.mid"], ["foo.in"]) +copy1(["foo.out"], ["foo.mid"]) """)) test.up_to_date(arguments='bar.out foo.out') @@ -90,9 +90,9 @@ TargetSignatures('content') test.run(arguments="bar.out foo.out", stdout=test.wrap_stdout("""\ -copy2("bar.mid", "bar.in") -copy1("bar.out", "bar.mid") -copy2("foo.mid", "foo.in") +copy2(["bar.mid"], ["bar.in"]) +copy1(["bar.out"], ["bar.mid"]) +copy2(["foo.mid"], ["foo.in"]) scons: `foo.out' is up to date. """)) @@ -122,8 +122,8 @@ TargetSignatures('build') test.run(arguments="bar.out foo.out", stdout=test.wrap_stdout("""\ -copy1("bar.out", "bar.mid") -copy1("foo.out", "foo.mid") +copy1(["bar.out"], ["bar.mid"]) +copy1(["foo.out"], ["foo.mid"]) """)) test.write('SConstruct', """ @@ -151,10 +151,10 @@ TargetSignatures('build') test.run(arguments='bar.out foo.out', stdout=test.wrap_stdout("""\ -copy2("bar.mid", "bar.in") +copy2(["bar.mid"], ["bar.in"]) scons: `bar.out' is up to date. -copy2("foo.mid", "foo.in") -copy1("foo.out", "foo.mid") +copy2(["foo.mid"], ["foo.in"]) +copy1(["foo.out"], ["foo.mid"]) """)) diff --git a/test/Touch.py b/test/Touch.py index 7a3ca19..b41db25 100644 --- a/test/Touch.py +++ b/test/Touch.py @@ -62,11 +62,11 @@ oldtime = os.path.getmtime(test.workpath('f1')) expect = test.wrap_stdout(read_str = 'Touch("f1")\n', build_str = """\ -cat("f2.out", "f2.in") +cat(["f2.out"], ["f2.in"]) Touch("f3") Touch("f4") -cat("f5.out", "f5.in") -cat("f6.out", "f6.in") +cat(["f5.out"], ["f5.in"]) +cat(["f6.out"], ["f6.in"]) Touch("Touch-f6.in") Touch("f6.out-Touch") """) diff --git a/test/Value.py b/test/Value.py index ee92d43..e3106b8 100644 --- a/test/Value.py +++ b/test/Value.py @@ -63,45 +63,39 @@ env.B('f3.out', Value(C)) test.run(arguments='-c') test.run() - out1 = """create("f1.out", "'/usr/local'")""" - out2 = """create("f2.out", "10")""" - out3 = """create\\("f3.out", "<.*.Custom instance at """ + out1 = """create(["f1.out"], ["'/usr/local'"])""" + out2 = """create(["f2.out"], ["10"])""" + out3 = """create\\(\\["f3.out"\\], \\["<.*.Custom instance at """ #" <- unconfuses emacs syntax highlighting test.fail_test(string.find(test.stdout(), out1) == -1) test.fail_test(string.find(test.stdout(), out2) == -1) test.fail_test(re.search(out3, test.stdout()) == None) - test.fail_test(not os.path.exists(test.workpath('f1.out'))) - test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr/local') - test.fail_test(not os.path.exists(test.workpath('f2.out'))) - test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '10') - test.fail_test(not os.path.exists(test.workpath('f3.out'))) - test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr/local') + test.must_match('f1.out', "/usr/local") + test.must_match('f2.out', "10") + test.must_match('f3.out', "C=/usr/local") test.up_to_date(arguments='.') test.run(arguments='prefix=/usr') - out4 = """create("f1.out", "'/usr'")""" - out5 = """create("f2.out", "4")""" - out6 = """create\\("f3.out", "<.*.Custom instance at """ + out4 = """create(["f1.out"], ["'/usr'"])""" + out5 = """create(["f2.out"], ["4"])""" + out6 = """create\\(\\["f3.out"\\], \\["<.*.Custom instance at """ #" <- unconfuses emacs syntax highlighting test.fail_test(string.find(test.stdout(), out4) == -1) test.fail_test(string.find(test.stdout(), out5) == -1) test.fail_test(re.search(out6, test.stdout()) == None) - test.fail_test(not os.path.exists(test.workpath('f1.out'))) - test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/usr') - test.fail_test(not os.path.exists(test.workpath('f2.out'))) - test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4') - test.fail_test(not os.path.exists(test.workpath('f3.out'))) - test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/usr') + test.must_match('f1.out', "/usr") + test.must_match('f2.out', "4") + test.must_match('f3.out', "C=/usr") test.up_to_date('prefix=/usr', '.') test.unlink('f3.out') test.run(arguments='prefix=/var') - out4 = """create("f1.out", "'/var'")""" + out4 = """create(["f1.out"], ["'/var'"])""" test.fail_test(string.find(test.stdout(), out4) == -1) test.fail_test(string.find(test.stdout(), out5) != -1) @@ -109,11 +103,8 @@ env.B('f3.out', Value(C)) test.up_to_date('prefix=/var', '.') - test.fail_test(not os.path.exists(test.workpath('f1.out'))) - test.fail_test(open(test.workpath('f1.out'), 'rb').read() != '/var') - test.fail_test(not os.path.exists(test.workpath('f2.out'))) - test.fail_test(open(test.workpath('f2.out'), 'rb').read() != '4') - test.fail_test(not os.path.exists(test.workpath('f3.out'))) - test.fail_test(open(test.workpath('f3.out'), 'rb').read() != 'C=/var') + test.must_match('f1.out', "/var") + test.must_match('f2.out', "4") + test.must_match('f3.out', "C=/var") test.pass_test() diff --git a/test/chained-build.py b/test/chained-build.py index ea9bec0..23187bc 100644 --- a/test/chained-build.py +++ b/test/chained-build.py @@ -53,10 +53,10 @@ test.write(['w1', 'foo.in'], "foo.in 1") test.run(chdir='w1', arguments="--max-drift=0 -f SConstruct1 foo.mid", - stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n')) + stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n')) test.run(chdir='w1', arguments="--max-drift=0 -f SConstruct2 foo.out", - stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n')) + stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n')) test.up_to_date(chdir='w1', options="--max-drift=0 -f SConstruct1", @@ -70,10 +70,10 @@ test.write(['w1', 'foo.in'], "foo.in 2") test.run(chdir='w1', arguments="--max-drift=0 -f SConstruct1 foo.mid", - stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n')) + stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n')) test.run(chdir='w1', arguments="--max-drift=0 -f SConstruct2 foo.out", - stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n')) + stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n')) test.up_to_date(chdir='w1', options="--max-drift=0 -f SConstruct1", @@ -90,10 +90,10 @@ test.write(['w2', 'foo.in'], "foo.in 1") test.run(chdir='w2', arguments="--max-drift=0 -f SConstruct1 foo.mid", - stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n')) + stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n')) test.run(chdir='w2', arguments="--max-drift=0 -f SConstruct2 foo.out", - stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n')) + stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n')) test.up_to_date(chdir='w2', options="--max-drift=0 -f SConstruct1", @@ -107,10 +107,10 @@ test.write(['w2', 'foo.in'], "foo.in 2") test.run(chdir='w2', arguments="--max-drift=0 -f SConstruct1 foo.mid", - stdout = test.wrap_stdout('build("foo.mid", "foo.in")\n')) + stdout = test.wrap_stdout('build(["foo.mid"], ["foo.in"])\n')) test.run(chdir='w2', arguments="--max-drift=0 -f SConstruct2 foo.out", - stdout = test.wrap_stdout('build("foo.out", "foo.mid")\n')) + stdout = test.wrap_stdout('build(["foo.out"], ["foo.mid"])\n')) test.up_to_date(chdir='w2', options="--max-drift=0 -f SConstruct1", diff --git a/test/multi.py b/test/multi.py index 9920cbc..989c636 100644 --- a/test/multi.py +++ b/test/multi.py @@ -56,7 +56,7 @@ test.write('file1b.in', 'file1b.in\n') test.run(arguments='file1.out') -test.fail_test(not test.read('file1.out') == 'file1a.in\nfile1b.in\n') +test.must_match('file1.out', "file1a.in\nfile1b.in\n") # @@ -135,7 +135,7 @@ test.write('file4b.in', 'file4b.in\n') test.run(arguments='file4.out') -test.fail_test(not test.read('file4.out') == 'file4a.in\nfile4b.in\n') +test.must_match('file4.out', "file4a.in\nfile4b.in\n") # @@ -162,11 +162,11 @@ test.write('file5b.in', 'file5b.in\n') test.run(arguments='file5.out', stderr=""" scons: warning: Two different environments were specified for target file5.out, - but they appear to have the same action: build("file5.out", "file5b.in") + but they appear to have the same action: build(["file5.out"], ["file5b.in"]) File "SConstruct", line 11, in ? """) -test.fail_test(not test.read('file5.out') == 'file5a.in\nfile5b.in\n') +test.must_match('file5.out', "file5a.in\nfile5b.in\n") # @@ -219,7 +219,7 @@ test.write('file7.in', 'file7.in\n') test.run(arguments='file7.out') -test.fail_test(not test.read('file7.out') == 'file7.in\n') +test.must_match('file7.out', "file7.in\n") # @@ -277,8 +277,8 @@ test.write('file9b.in', 'file9b.in\n') test.run(arguments='file9b.out') -test.fail_test(not test.read('file9a.out') == 'file9a.in\nfile9b.in\n') -test.fail_test(not test.read('file9b.out') == 'file9a.in\nfile9b.in\n') +test.must_match('file9a.out', "file9a.in\nfile9b.in\n") +test.must_match('file9b.out', "file9a.in\nfile9b.in\n") # diff --git a/test/option--cd.py b/test/option--cd.py index e68256b..9aa9402 100644 --- a/test/option--cd.py +++ b/test/option--cd.py @@ -63,8 +63,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n") # This should populate the cache with our derived files. test.run(chdir = 'src', arguments = '.') -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n") +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") test.up_to_date(chdir = 'src', arguments = '.') @@ -80,8 +80,8 @@ Retrieved `ccc.out' from cache Retrieved `all' from cache """)) -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(os.path.exists(test.workpath('src', 'cat.out'))) +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_not_exist(test.workpath('src', 'cat.out')) test.up_to_date(chdir = 'src', arguments = '.') @@ -92,14 +92,14 @@ test.run(chdir = 'src', arguments = '-c .') test.run(chdir = 'src', arguments = '--cache-disable .', stdout = test.wrap_stdout("""\ -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """)) -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n") +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") test.up_to_date(chdir = 'src', arguments = '.') @@ -111,14 +111,14 @@ test.unlink(['src', 'cat.out']) test.run(chdir = 'src', arguments = '--no-cache .', stdout = test.wrap_stdout("""\ -cat("aaa.out", "aaa.in") -cat("bbb.out", "bbb.in") -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["aaa.out"], ["aaa.in"]) +cat(["bbb.out"], ["bbb.in"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """)) -test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n") +test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") test.up_to_date(chdir = 'src', arguments = '.') diff --git a/test/option--cs.py b/test/option--cs.py index 00ec2f9..5f0ec39 100644 --- a/test/option--cs.py +++ b/test/option--cs.py @@ -77,9 +77,9 @@ test.write(['src1', 'ccc.in'], "ccc.in\n") # This should populate the cache with our derived files. test.run(chdir = 'src1', arguments = '.') -test.fail_test(test.read(['src1', 'all']) != "aaa.in\nbbb.in\nccc.in\n") +test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(test.read(['src1', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n") +test.must_match(['src1', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n") test.up_to_date(chdir = 'src1', arguments = '.') @@ -95,7 +95,7 @@ Retrieved `ccc.out' from cache Retrieved `all' from cache """)) -test.fail_test(os.path.exists(test.workpath('src1', 'cat.out'))) +test.must_not_exist(test.workpath('src1', 'cat.out')) test.up_to_date(chdir = 'src1', arguments = '.') @@ -108,11 +108,11 @@ test.run(chdir = 'src1', stdout = test.wrap_stdout("""\ %s build.py aaa.out aaa.in %s build.py bbb.out bbb.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """ % (python, python))) -test.fail_test(os.path.exists(test.workpath('src1', 'cat.out'))) +test.must_not_exist(test.workpath('src1', 'cat.out')) test.up_to_date(chdir = 'src1', arguments = '.') @@ -126,16 +126,16 @@ test.run(chdir = 'src1', stdout = test.wrap_stdout("""\ %s build.py aaa.out aaa.in %s build.py bbb.out bbb.in -cat("ccc.out", "ccc.in") -cat("all", ["aaa.out", "bbb.out", "ccc.out"]) +cat(["ccc.out"], ["ccc.in"]) +cat(["all"], ["aaa.out", "bbb.out", "ccc.out"]) """ % (python, python))) -test.fail_test(os.path.exists(test.workpath('src1', 'cat.out'))) +test.must_not_exist(test.workpath('src1', 'cat.out')) -test.fail_test(os.path.exists(test.workpath('src1', 'aaa.out'))) -test.fail_test(os.path.exists(test.workpath('src1', 'bbb.out'))) -test.fail_test(os.path.exists(test.workpath('src1', 'ccc.out'))) -test.fail_test(os.path.exists(test.workpath('src1', 'all'))) +test.must_not_exist(test.workpath('src1', 'aaa.out')) +test.must_not_exist(test.workpath('src1', 'bbb.out')) +test.must_not_exist(test.workpath('src1', 'ccc.out')) +test.must_not_exist(test.workpath('src1', 'all')) # Verify that using --cache-show -s doesn't report anything, even though # we do fetch the files from the cache. No need to clean up. @@ -143,8 +143,8 @@ test.run(chdir = 'src1', arguments = '--cache-show -s .', stdout = "") -test.fail_test(test.read(['src1', 'all']) != "aaa.in\nbbb.in\nccc.in\n") -test.fail_test(os.path.exists(test.workpath('src1', 'cat.out'))) +test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n") +test.must_not_exist(test.workpath('src1', 'cat.out')) # hello_exe = 'hello' + _exe diff --git a/test/option--debug.py b/test/option--debug.py index 0893170..64cc424 100644 --- a/test/option--debug.py +++ b/test/option--debug.py @@ -323,13 +323,13 @@ __PYTHON__ cat.py file06.in temp __PYTHON__ cat.py temp file06.out Building file07.out with action(s): cat(env, target, source) -cat("file07.out", "file07.in") +cat(["file07.out"], ["file07.in"]) Building file08.out with action(s): cat(env, target, source) -cat("file08.out", "file08.in") +cat(["file08.out"], ["file08.in"]) Building file09.out with action(s): cat(env, target, source) -cat("file09.out", "file09.in") +cat(["file09.out"], ["file09.in"]) Building file11.out with action(s): $PYTHON cat.py $SOURCES $TARGET __PYTHON__ cat.py file11.in file11.out @@ -358,10 +358,10 @@ __PYTHON__ cat.py file16.in temp __PYTHON__ cat.py temp file16.out Building file17.out with action(s): cat(env, target, source) -cat("file17.out", "file17.in") +cat(["file17.out"], ["file17.in"]) Building file18.out with action(s): cat(env, target, source) -cat("file18.out", "file18.in") +cat(["file18.out"], ["file18.in"]) """ expect = string.replace(expect, '__PYTHON__', TestSCons.python) test.run(arguments = "--debug=presub .", stdout=test.wrap_stdout(expect)) diff --git a/test/option--warn.py b/test/option--warn.py index 8c84b6d..155545b 100644 --- a/test/option--warn.py +++ b/test/option--warn.py @@ -127,16 +127,16 @@ test.write('file1b.in', 'file1b.in\n') test.run(arguments='file1.out', stderr=r""" scons: warning: Two different environments were specified for target file1.out, - but they appear to have the same action: build\("file1.out", "file1b.in"\) + but they appear to have the same action: build\(\["file1.out"\], \["file1b.in"\]\) File "SConstruct", line \d+, in .+ """) -test.fail_test(not test.read('file1.out') == 'file1a.in\nfile1b.in\n') +test.must_match('file1.out', "file1a.in\nfile1b.in\n") test.run(arguments='--warn=duplicate-environment file1.out', stderr=r""" scons: warning: Two different environments were specified for target file1.out, - but they appear to have the same action: build\("file1.out", "file1b.in"\) + but they appear to have the same action: build\(\["file1.out"\], \["file1b.in"\]\) File "SConstruct", line \d+, in .+ """) diff --git a/test/option-u.py b/test/option-u.py index 82583d4..28bab30 100644 --- a/test/option-u.py +++ b/test/option-u.py @@ -84,37 +84,37 @@ test.write(['sub4', 'dir', 'f4b.in'], "sub4/dir/f4b.in") # Verify that we only build the specified local argument. test.run(chdir = 'sub1', arguments = '-u f1a.out') -test.fail_test(test.read(['sub1', 'f1a.out']) != "sub1/f1a.in") -test.fail_test(os.path.exists(test.workpath('sub1', 'sub1/f1b.out'))) -test.fail_test(os.path.exists(test.workpath('sub2', 'f2a.out'))) -test.fail_test(os.path.exists(test.workpath('sub2', 'dir', 'f2b.out'))) -test.fail_test(os.path.exists(test.workpath('sub3', 'f3.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'dir', 'f4b.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'dir', 'f4b.out'))) +test.must_match(['sub1', 'f1a.out'], "sub1/f1a.in") +test.must_not_exist(test.workpath('sub1', 'sub1/f1b.out')) +test.must_not_exist(test.workpath('sub2', 'f2a.out')) +test.must_not_exist(test.workpath('sub2', 'dir', 'f2b.out')) +test.must_not_exist(test.workpath('sub3', 'f3.out')) +test.must_not_exist(test.workpath('sub4', 'f4a.out')) +test.must_not_exist(test.workpath('sub4', 'dir', 'f4b.out')) +test.must_not_exist(test.workpath('build', 'f4a.out')) +test.must_not_exist(test.workpath('build', 'dir', 'f4b.out')) # Verify that we build everything at or below our current directory. test.run(chdir = 'sub2', arguments = '-u') -test.fail_test(os.path.exists(test.workpath('sub1', 'sub1/f1b.out'))) -test.fail_test(test.read(['sub2', 'f2a.out']) != "sub2/f2a.in") -test.fail_test(test.read(['sub2', 'dir', 'f2b.out']) != "sub2/dir/f2b.in") -test.fail_test(os.path.exists(test.workpath('sub3', 'f3.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'dir', 'f4b.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'dir', 'f4b.out'))) +test.must_not_exist(test.workpath('sub1', 'sub1/f1b.out')) +test.must_match(['sub2', 'f2a.out'], "sub2/f2a.in") +test.must_match(['sub2', 'dir', 'f2b.out'], "sub2/dir/f2b.in") +test.must_not_exist(test.workpath('sub3', 'f3.out')) +test.must_not_exist(test.workpath('sub4', 'f4a.out')) +test.must_not_exist(test.workpath('sub4', 'dir', 'f4b.out')) +test.must_not_exist(test.workpath('build', 'f4a.out')) +test.must_not_exist(test.workpath('build', 'dir', 'f4b.out')) # Verify that we build a specified alias, regardless of where. test.run(chdir = 'sub2', arguments = '-u my_alias') -test.fail_test(os.path.exists(test.workpath('sub1', 'sub1/f1b.out'))) -test.fail_test(test.read(['sub3', 'f3.out']) != "sub3/f3.in") -test.fail_test(os.path.exists(test.workpath('sub4', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'dir', 'f4b.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('build', 'dir', 'f4b.out'))) +test.must_not_exist(test.workpath('sub1', 'sub1/f1b.out')) +test.must_match(['sub3', 'f3.out'], "sub3/f3.in") +test.must_not_exist(test.workpath('sub4', 'f4a.out')) +test.must_not_exist(test.workpath('sub4', 'dir', 'f4b.out')) +test.must_not_exist(test.workpath('build', 'f4a.out')) +test.must_not_exist(test.workpath('build', 'dir', 'f4b.out')) # Verify that we build things in a linked BuildDir. f4a_in = os.path.join('build', 'f4a.in') @@ -126,15 +126,15 @@ test.run(chdir = 'sub4', stdout = "scons: Entering directory `%s'\n" % test.workpath() + \ test.wrap_stdout("""\ scons: building associated BuildDir targets: build -cat("%s", "%s") -cat("%s", "%s") +cat(["%s"], ["%s"]) +cat(["%s"], ["%s"]) """ % (f4b_out, f4b_in, f4a_out, f4a_in))) -test.fail_test(os.path.exists(test.workpath('sub1', 'sub1/f1b.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'f4a.out'))) -test.fail_test(os.path.exists(test.workpath('sub4', 'dir', 'f4b.out'))) -test.fail_test(test.read(['build', 'f4a.out']) != "sub4/f4a.in") -test.fail_test(test.read(['build', 'dir', 'f4b.out']) != "sub4/dir/f4b.in") +test.must_not_exist(test.workpath('sub1', 'sub1/f1b.out')) +test.must_not_exist(test.workpath('sub4', 'f4a.out')) +test.must_not_exist(test.workpath('sub4', 'dir', 'f4b.out')) +test.must_match(['build', 'f4a.out'], "sub4/f4a.in") +test.must_match(['build', 'dir', 'f4b.out'], "sub4/dir/f4b.in") # Make sure explicit targets beginning with ../ get built. test.subdir('sub6', ['sub6', 'dir']) @@ -167,9 +167,9 @@ test.write(['sub6', 'dir', 'f4.in'], "f4.in\n") test.run(chdir = 'sub6/dir', arguments = '-u ../f2.out') -test.fail_test(os.path.exists(test.workpath('sub6', 'f1.out'))) -test.fail_test(not os.path.exists(test.workpath('sub6', 'f2.out'))) -test.fail_test(os.path.exists(test.workpath('sub6', 'dir', 'f3.out'))) -test.fail_test(os.path.exists(test.workpath('sub6', 'dir', 'f4.out'))) +test.must_not_exist(test.workpath('sub6', 'f1.out')) +test.must_exist(test.workpath('sub6', 'f2.out')) +test.must_not_exist(test.workpath('sub6', 'dir', 'f3.out')) +test.must_not_exist(test.workpath('sub6', 'dir', 'f4.out')) test.pass_test() diff --git a/test/overrides.py b/test/overrides.py index fa76b56..1013413 100644 --- a/test/overrides.py +++ b/test/overrides.py @@ -54,11 +54,11 @@ test.write('foo.in', "foo.in\n") test.write('bar.in', "bar.in\n") test.run(arguments = "-Q", stdout = """\ -build("foo.out", "foo.in") +build(["foo.out"], ["foo.in"]) env['CC'] = mycc env['CCFLAGS'] = -DFOO -DBAR env['LIBS'] = ['a', 'b'] -build("bar.out", "bar.in") +build(["bar.out"], ["bar.in"]) env['CC'] = buildcc env['CCFLAGS'] = -DFOO env['LIBS'] = buildlibs diff --git a/test/sconsign.py b/test/sconsign.py index 50b7bb1..e9a6609 100644 --- a/test/sconsign.py +++ b/test/sconsign.py @@ -87,7 +87,7 @@ scons: warning: Ignoring corrupt .sconsign file: sub1.\.sconsign .* ''' -stdout = test.wrap_stdout('build1\("sub1.foo\.out", "foo\.in"\)\n') +stdout = test.wrap_stdout('build1\(\["sub1.foo\.out"\], \["foo\.in"\]\)\n') test.write(sub1__sconsign, 'not:a:sconsign:file') test.run(arguments = '.', stderr=stderr, stdout=stdout) diff --git a/test/strfunction.py b/test/strfunction.py index 4ed75ee..c8b2665 100644 --- a/test/strfunction.py +++ b/test/strfunction.py @@ -121,14 +121,14 @@ test.run(arguments = '.', stdout=test.wrap_stdout("""\ Building cmdstr.out from cmdstr.in %s cat.py dict1.cmd dict1.out Building dict2.out from dict2.cmdstr -func("dict3.out", "dict3.func") +func(["dict3.out"], ["dict3.func"]) Building dict4.out from dict4.funcstr %s cat.py dict5.lazy dict5.out Building dict6.out from dict6.lazystr %s cat.py dict7.list .temp %s cat.py .temp dict7.out Building dict8.out from dict8.liststr -func("func.out", "func.in") +func(["func.out"], ["func.in"]) Building funcstr.out from funcstr.in %s cat.py lazy.in lazy.out Building lazystr.out from lazystr.in |