- Add --debug=objects logging of creation of OverrideWarner,
EnvironmentCopy and EnvironmentOverride objects.
+ - Fix command-line expansion of Python Value Nodes.
+
From Levi Stephen:
- Allow $JARCHDIR to be expanded to other construction variables.
dict['TARGET'] = Target_or_Source(tnl)
if source:
- snl = NLWrapper(source, lambda x: x.rfile().get_subst_proxy())
+ def get_src_subst_proxy(node):
+ try:
+ rfile = node.rfile
+ except AttributeError:
+ pass
+ else:
+ node = rfile()
+ return node.get_subst_proxy()
+ snl = NLWrapper(source, get_src_subst_proxy)
dict['SOURCES'] = Targets_or_Sources(snl)
dict['SOURCE'] = Target_or_Source(snl)
assert SOURCES == ['s1', 's2'], d['SOURCES']
assert str(d['SOURCE']) == 's1', d['SOURCE']
- class N:
+ class V:
+ # Fake Value node with no rfile() method.
def __init__(self, name):
self.name = name
def __str__(self):
- return self.name
- def rfile(self):
- return self.__class__('rstr-' + self.name)
+ return 'v-'+self.name
def get_subst_proxy(self):
return self
+ class N(V):
+ def rfile(self):
+ return self.__class__('rstr-' + self.name)
+
t3 = N('t3')
t4 = DummyNode('t4')
+ t5 = V('t5')
s3 = DummyNode('s3')
s4 = N('s4')
- d = subst_dict(target=[t3, t4], source=[s3, s4])
+ s5 = V('s5')
+ d = subst_dict(target=[t3, t4, t5], source=[s3, s4, s5])
TARGETS = map(lambda x: str(x), d['TARGETS'])
TARGETS.sort()
- assert TARGETS == ['t3', 't4'], d['TARGETS']
+ assert TARGETS == ['t4', 'v-t3', 'v-t5'], TARGETS
SOURCES = map(lambda x: str(x), d['SOURCES'])
SOURCES.sort()
- assert SOURCES == ['rstr-s4', 's3'], d['SOURCES']
+ assert SOURCES == ['s3', 'v-rstr-s4', 'v-s5'], SOURCES
def test_PrependPath(self):
"""Test prepending to a path"""
print "Testing Value node with source signatures:", source_signature
test.write('SConstruct', """
-SourceSignatures(r'%s')
+SourceSignatures(r'%(source_signature)s')
class Custom:
def __init__(self, value): self.value = value
env = Environment()
env['BUILDERS']['B'] = Builder(action = create)
+env['BUILDERS']['S'] = Builder(action = "%(python)s put $SOURCES into $TARGET")
env.B('f1.out', Value(P))
env.B('f2.out', env.Value(L))
env.B('f3.out', Value(C))
-""" % source_signature)
+env.S('f4.out', Value(L))
+""" % {'source_signature':source_signature,
+ 'python':TestSCons.python})
+
+ test.write('put', """
+import os
+import string
+import sys
+open(sys.argv[-1],'wb').write(string.join(sys.argv[1:-2]))
+""")
test.run(arguments='-c')
test.run()
test.must_match('f1.out', "/usr/local")
test.must_match('f2.out', "10")
test.must_match('f3.out', "C=/usr/local")
+ test.must_match('f4.out', '10')
test.up_to_date(arguments='.')
test.must_match('f1.out', "/usr")
test.must_match('f2.out', "4")
test.must_match('f3.out', "C=/usr")
+ test.must_match('f4.out', '4')
test.up_to_date('prefix=/usr', '.')
test.must_match('f1.out', "/var")
test.must_match('f2.out', "4")
test.must_match('f3.out', "C=/var")
+ test.must_match('f4.out', "4")
test.pass_test()