Support override expansions within target and source files names.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 14 Nov 2004 21:30:31 +0000 (21:30 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 14 Nov 2004 21:30:31 +0000 (21:30 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1160 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Environment.py
src/engine/SCons/EnvironmentTests.py
test/Command.py

index 003163bb9b44fd8a7856b92934861ad1c4bac22c..4755f18a2a119b978a449efae3f1003e7db6a70c 100644 (file)
@@ -127,6 +127,9 @@ RELEASE 0.97 - XXX
   - Allow Aliases to have actions that will be executed whenever
     any of the expanded Alias targets are out of date.
 
+  - Fix expansion of env.Command() overrides within target and
+    source file names.
+
   From Wayne Lee:
 
   - Avoid "maximum recursion limit" errors when removing $(-$) pairs
index ef3b2d0ff35aec0d782138073b328fe1342b26c3..740297bcd98f3846f69947e7714542a23f4411b2 100644 (file)
@@ -1135,11 +1135,9 @@ class Base:
         source files using the supplied action.  Action may
         be any type that the Builder constructor will accept
         for an action."""
-        nkw = self.subst_kw(kw)
-        nkw['action'] = action
-        nkw['source_factory'] = self.fs.Entry
-        bld = apply(SCons.Builder.Builder, (), nkw)
-        return bld(self, target, source)
+        bld = SCons.Builder.Builder(action = action,
+                                    source_factory = self.fs.Entry)
+        return apply(bld, (self, target, source), kw)
 
     def Depends(self, target, dependency):
         """Explicity specify that 'target's depend on 'dependency'."""
index 9b84f3c83fc93910b1d4f8905b865382af17c206..4c9a0be155c59d494ca8111aadf808711937c586 100644 (file)
@@ -1995,6 +1995,12 @@ f5: \
         t.build()
         assert x[0] == 'magic word', x
 
+        t = env.Command(target='${X}.out', source='${X}.in',
+                        action = 'foo',
+                        X = 'xxx')[0]
+        assert str(t) == 'xxx.out', str(t)
+        assert 'xxx.in' in map(lambda x: x.path, t.sources)
+
     def test_Configure(self):
         """Test the Configure() method"""
         # Configure() will write to a local temporary file.
index eddc1f5d4530e0a3ed22c02a2cfa9c3860dc648b..6563bd9ccfc3177639ab760e47cac0a27cb3c14f 100644 (file)
@@ -85,6 +85,9 @@ Command(target = 'f8.out', source = 'f8.in',
         action = r"%(python)s build.py $TARGET $SOURCE")
 env.Command(target = 'f9.out', source = 'f9.in',
             action = r"$EXPAND")
+env.Command(target = '${F10}.out', source = '${F10}.in',
+            action = r"%(python)s build.py $TARGET $SOURCE",
+            F10 = 'f10')
 """ % {'python': python})
 
 test.write('f1.in', "f1.in\n")
@@ -98,6 +101,7 @@ test.write('f6.in', "f6.in\n")
 test.write('f7.in', "f7.in\n")
 test.write('f8.in', "f8.in\n")
 test.write('f9.in', "f9.in\n")
+test.write('f10.in', "f10.in\n")
 
 test.run(arguments = '.')
 
@@ -110,5 +114,6 @@ test.must_match('f6.out', "f6.in\n")
 test.must_match('f7.out', "f7.in\n")
 test.must_match('f8.out', "f8.in\n")
 test.must_match('f9.out', "f9.in\n")
+test.must_match('f10.out', "f10.in\n")
 
 test.pass_test()