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),
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:
return ''
return repr(nl0)
-def subst_dict(target, source, env):
+def subst_dict(target, source):
"""Create a dictionary for substitution of special
construction variables.
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())
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)
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)
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']
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']
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']