diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 1 | ||||
-rw-r--r-- | src/engine/SCons/Environment.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 11 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 285ffbe..20c3b35 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,7 @@ RELEASE 0.96 - XXX - Add an Execute() method for executing actions directly. + - Support passing environment override keyword arguments to Command(). RELEASE 0.95 - Mon, 08 Mar 2004 06:43:20 -0600 diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index ca25021..0edff88 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -892,13 +892,15 @@ class Base: pass return apply(SCons.SConf.SConf, nargs, nkw) - def Command(self, target, source, action): + def Command(self, target, source, action, **kw): """Builds the supplied target files from the supplied source files using the supplied action. Action may be any type that the Builder constructor will accept for an action.""" - bld = SCons.Builder.Builder(action=action, - source_factory=self.fs.Entry) + 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) def Depends(self, target, dependency): diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index ca0b458..3850ef6 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -1671,6 +1671,17 @@ class EnvironmentTestCase(unittest.TestCase): assert 'foo1.in' in map(lambda x: x.path, t.sources) assert 'foo2.in' in map(lambda x: x.path, t.sources) + x = [] + def test2(baz, x=x): + x.append(baz) + env = Environment(TEST2 = test2) + t = env.Command(target='baz.out', source='baz.in', + action='${TEST2(XYZ)}', + XYZ='magic word') + assert not t.builder is None + t.build() + assert x[0] == 'magic word', x + def test_Configure(self): """Test the Configure() method""" # Configure() will write to a local temporary file. |