summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-02-07 13:19:34 (GMT)
committerSteven Knight <knight@baldmt.com>2004-02-07 13:19:34 (GMT)
commit18876ab2a7399e97fa1663b64d917fbfeba57cca (patch)
treeca0d5cfe3d4b8e20fb05bcea0707a69aa1c2d64f /src
parent7db087e4c1efd7c5029befea03f904a6f0d21a44 (diff)
downloadSCons-18876ab2a7399e97fa1663b64d917fbfeba57cca.zip
SCons-18876ab2a7399e97fa1663b64d917fbfeba57cca.tar.gz
SCons-18876ab2a7399e97fa1663b64d917fbfeba57cca.tar.bz2
Move the __env__ construction variable into the Environment itself, not created in the subst_dict each time.
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Action.py2
-rw-r--r--src/engine/SCons/Environment.py1
-rw-r--r--src/engine/SCons/Util.py12
-rw-r--r--src/engine/SCons/UtilTests.py11
4 files changed, 9 insertions, 17 deletions
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index d9dbca1..6759b02 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -440,7 +440,7 @@ class ListAction(ActionBase):
Simple concatenation of the signatures of the elements.
"""
- dict = SCons.Util.subst_dict(target, source, env)
+ dict = SCons.Util.subst_dict(target, source)
return string.join(map(lambda x, t=target, s=source, e=env, d=dict:
x.get_contents(t, s, e, d),
self.list),
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 43cb2c3..46897ef 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -218,6 +218,7 @@ class Base:
self.lookup_list = SCons.Node.arg2nodes_lookups
self._dict = our_deepcopy(SCons.Defaults.ConstructionEnvironment)
+ self._dict['__env__'] = self
self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self)
if platform is None:
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 594274a..6643393 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -440,7 +440,7 @@ class Target_or_Source:
return ''
return repr(nl0)
-def subst_dict(target, source, env):
+def subst_dict(target, source):
"""Create a dictionary for substitution of special
construction variables.
@@ -453,12 +453,8 @@ def subst_dict(target, source, env):
source - the source (object or array of objects),
used to generate the SOURCES and SOURCE
construction variables
-
- env - the construction Environment used for this
- build, which is made available as the __env__
- construction variable
"""
- dict = { '__env__' : env, }
+ dict = {}
if target:
tnl = NLWrapper(target, lambda x: x.get_subst_proxy())
@@ -603,7 +599,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, dict=No
return self.expand(args, lvars)
if dict is None:
- dict = subst_dict(target, source, env)
+ dict = subst_dict(target, source)
ss = StringSubber(env, mode, target, source)
result = ss.substitute(strSubst, dict)
@@ -785,7 +781,7 @@ def scons_subst_list(strSubst, env, mode=SUBST_RAW, target=None, source=None, di
self.in_strip = None
if dict is None:
- dict = subst_dict(target, source, env)
+ dict = subst_dict(target, source)
ls = ListSubber(env, mode, target, source)
ls.substitute(strSubst, dict, 0)
diff --git a/src/engine/SCons/UtilTests.py b/src/engine/SCons/UtilTests.py
index 6468949..687d464 100644
--- a/src/engine/SCons/UtilTests.py
+++ b/src/engine/SCons/UtilTests.py
@@ -1133,14 +1133,9 @@ class UtilTestCase(unittest.TestCase):
def test_subst_dict(self):
"""Test substituting dictionary values in an Action
"""
- env = DummyEnv({'a' : 'A', 'b' : 'B'})
- d = subst_dict([], [], env)
- assert d['__env__'] is env, d['__env__']
-
t = DummyNode('t')
s = DummyNode('s')
- env = DummyEnv()
- d = subst_dict(target=t, source=s, env=env)
+ d = subst_dict(target=t, source=s)
assert str(d['TARGETS'][0]) == 't', d['TARGETS']
assert str(d['TARGET']) == 't', d['TARGET']
assert str(d['SOURCES'][0]) == 's', d['SOURCES']
@@ -1150,7 +1145,7 @@ class UtilTestCase(unittest.TestCase):
t2 = DummyNode('t2')
s1 = DummyNode('s1')
s2 = DummyNode('s2')
- d = subst_dict(target=[t1, t2], source=[s1, s2], env=env)
+ d = subst_dict(target=[t1, t2], source=[s1, s2])
TARGETS = map(lambda x: str(x), d['TARGETS'])
TARGETS.sort()
assert TARGETS == ['t1', 't2'], d['TARGETS']
@@ -1174,7 +1169,7 @@ class UtilTestCase(unittest.TestCase):
t4 = DummyNode('t4')
s3 = DummyNode('s3')
s4 = N('s4')
- d = subst_dict(target=[t3, t4], source=[s3, s4], env=env)
+ d = subst_dict(target=[t3, t4], source=[s3, s4])
TARGETS = map(lambda x: str(x), d['TARGETS'])
TARGETS.sort()
assert TARGETS == ['t3', 't4'], d['TARGETS']