diff options
| author | Steven Knight <knight@baldmt.com> | 2003-07-21 12:03:33 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-07-21 12:03:33 (GMT) |
| commit | d77bd9aa09a469f734d52951f09ec8b649d33482 (patch) | |
| tree | afaf9d46954b81e86194f5201dd87e0a640c4fd4 /src/engine/SCons/Environment.py | |
| parent | cf7a4545126e4fe5a0c36c0c26b74980d1c06c9a (diff) | |
| download | SCons-d77bd9aa09a469f734d52951f09ec8b649d33482.zip SCons-d77bd9aa09a469f734d52951f09ec8b649d33482.tar.gz SCons-d77bd9aa09a469f734d52951f09ec8b649d33482.tar.bz2 | |
Support specifying a list of tools when calling env.Copy(). (Chad Austin)
Diffstat (limited to 'src/engine/SCons/Environment.py')
| -rw-r--r-- | src/engine/SCons/Environment.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index cbf7a7c..47d2e24 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -83,6 +83,13 @@ def our_deepcopy(x): copy = x return copy +def apply_tools(env, tools): + if tools: + for tool in tools: + if SCons.Util.is_String(tool): + tool = SCons.Tool.Tool(tool) + tool(env) + class BuilderWrapper: """Wrapper class that associates an environment with a Builder at instantiation.""" @@ -183,10 +190,7 @@ class Environment: if tools is None: tools = ['default'] - for tool in tools: - if SCons.Util.is_String(tool): - tool = SCons.Tool.Tool(tool) - tool(self) + apply_tools(self, tools) # Reapply the passed in variables after calling the tools, # since they should overide anything set by the tools: @@ -204,7 +208,7 @@ class Environment: def Builders(self): pass # XXX - def Copy(self, **kw): + def Copy(self, tools=None, **kw): """Return a copy of a construction Environment. The copy is like a Python "deep copy"--that is, independent copies are made recursively of each objects--except that @@ -219,6 +223,10 @@ class Environment: clone._dict['BUILDERS'] = BuilderDict(cbd, clone) except KeyError: pass + + apply_tools(clone, tools) + + # Apply passed-in variables after the new tools. apply(clone.Replace, (), kw) return clone |
