summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2001-12-17 05:36:08 (GMT)
committerSteven Knight <knight@baldmt.com>2001-12-17 05:36:08 (GMT)
commit2c6e8c67b164bd354d5f34c4b260ef0ca6c6c473 (patch)
treec30ce7708b16e20a505bb00d966002f9f3a58e36
parentafe9f16b5aeb7fc9861c354a58b05d3f2119b46b (diff)
downloadSCons-2c6e8c67b164bd354d5f34c4b260ef0ca6c6c473.zip
SCons-2c6e8c67b164bd354d5f34c4b260ef0ca6c6c473.tar.gz
SCons-2c6e8c67b164bd354d5f34c4b260ef0ca6c6c473.tar.bz2
Make Default() accept a node
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/Script.py17
-rw-r--r--test/Default.py16
3 files changed, 29 insertions, 6 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 23a7da7..953c9e6 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -23,6 +23,8 @@ RELEASE 0.02 -
- Fixed SCONS_LIB_DIR to work as documented (courtesy Anthony Roach).
+ - Made Default() accept Nodes as arguments (courtesy Anthony Roach).
+
RELEASE 0.01 - Thu Dec 13 19:25:23 CST 2001
diff --git a/src/engine/SCons/Script.py b/src/engine/SCons/Script.py
index 086e470..15abb48 100644
--- a/src/engine/SCons/Script.py
+++ b/src/engine/SCons/Script.py
@@ -166,8 +166,11 @@ def SConscript(sconscript, export={}):
def Default(*targets):
for t in targets:
- for s in string.split(t):
- default_targets.append(s)
+ if isinstance(t, SCons.Node.Node):
+ default_targets.append(t)
+ else:
+ for s in string.split(t):
+ default_targets.append(s)
def Help(text):
global help_option
@@ -648,8 +651,14 @@ def _main():
if not targets:
targets = default_targets
-
- nodes = map(lambda x: SCons.Node.FS.default_fs.Entry(x), targets)
+
+ def Entry(x):
+ if isinstance(x, SCons.Node.Node):
+ return x
+ else:
+ return SCons.Node.FS.default_fs.Entry(x)
+
+ nodes = map(Entry, targets)
if not calc:
calc = SCons.Sig.Calculator(SCons.Sig.MD5)
diff --git a/test/Default.py b/test/Default.py
index ceab745..135d7cb 100644
--- a/test/Default.py
+++ b/test/Default.py
@@ -32,7 +32,7 @@ python = sys.executable
test = TestSCons.TestSCons()
-test.subdir('one', 'two', 'three')
+test.subdir('one', 'two', 'three', 'four')
test.write('build.py', r"""
import sys
@@ -66,7 +66,15 @@ env.B(target = 'bar.out', source = 'bar.in')
Default('foo.out bar.out')
""" % python)
-for dir in ['one', 'two', 'three']:
+test.write(['four', 'SConstruct'], """
+B = Builder(name = 'B', action = r'%s ../build.py $TARGET $SOURCES')
+env = Environment(BUILDERS = [B])
+Default(env.B(target = 'foo.out', source = 'foo.in'))
+Default(env.B(target = 'bar.out', source = 'bar.in'))
+""" % python)
+
+
+for dir in ['one', 'two', 'three', 'four']:
foo_in = os.path.join(dir, 'foo.in')
bar_in = os.path.join(dir, 'bar.in')
@@ -86,4 +94,8 @@ test.fail_test(test.read(test.workpath('two', 'bar.out')) != "two/bar.in\n")
test.fail_test(test.read(test.workpath('three', 'foo.out')) != "three/foo.in\n")
test.fail_test(test.read(test.workpath('three', 'bar.out')) != "three/bar.in\n")
+test.fail_test(test.read(test.workpath('four', 'foo.out')) != "four/foo.in\n")
+test.fail_test(test.read(test.workpath('four', 'bar.out')) != "four/bar.in\n")
+
+
test.pass_test()