if kw.has_key('target'):
t = kw['target']
del kw['target']
- if type(t) is type(""):
+ if not type(t) is types.ListType:
t = [t]
- dict['TARGETS'] = PathList(map(os.path.normpath, t))
+ dict['TARGETS'] = PathList(map(os.path.normpath, map(str, t)))
if dict['TARGETS']:
dict['TARGET'] = dict['TARGETS'][0]
if kw.has_key('source'):
s = kw['source']
del kw['source']
- if type(s) is type(""):
+ if not type(s) is types.ListType:
s = [s]
- dict['SOURCES'] = PathList(map(os.path.normpath, s))
+ dict['SOURCES'] = PathList(map(os.path.normpath, map(str, s)))
dict.update(kw)
# if print_actions:
# XXX: WHAT SHOULD WE PRINT HERE?
if execute_actions:
+ if kw.has_key('target'):
+ if type(kw['target']) is types.ListType:
+ kw['target'] = map(str, kw['target'])
+ else:
+ kw['target'] = str(kw['target'])
+ if kw.has_key('source'):
+ kw['source'] = map(str, kw['source'])
return apply(self.function, (), kw)
def get_contents(self, **kw):
c = test.read(outfile, 'r')
assert c == "act.py: 'out5' 'XYZZY'\nact.py: 'xyzzy'\n", c
+ class Obj:
+ def __init__(self, str):
+ self._str = str
+ def __str__(self):
+ return self._str
+
+ cmd6 = r'%s %s %s ${TARGETS[1]} $TARGET ${SOURCES[:2]}' % (python, act_py, outfile)
+
+ builder = SCons.Builder.Builder(action = cmd6)
+ r = builder.execute(target = [Obj('111'), Obj('222')],
+ source = [Obj('333'), Obj('444'), Obj('555')])
+ assert r == 0
+ c = test.read(outfile, 'r')
+ assert c == "act.py: '222' '111' '333' '444'\n", c
+
cmd7 = '%s %s %s one\n\n%s %s %s two' % (python, act_py, outfile,
python, act_py, outfile)
expect7 = '%s %s %s one\n%s %s %s two\n' % (python, act_py, outfile,
node.sources = ["yyy", "zzz"]
node.build()
assert built_it
- assert built_target == "xxx", built_target
+ assert type(built_target) == type(MyNode()), type(built_target)
+ assert str(built_target) == "xxx", str(built_target)
assert built_source == ["yyy", "zzz"], built_source
def test_builder_set(self):
"""Actually build the node. Return the status from the build."""
if not self.builder:
return None
- sources = map(lambda x: str(x), self.sources)
stat = self.builder.execute(env = self.env.Dictionary(),
- target = str(self), source = sources)
+ target = self, source = self.sources)
if stat != 0:
raise BuildError(node = self, stat = stat)
return stat