self[suffix] = action
def __call__(self, target, source, env, for_signature):
+ if not source:
+ return []
+
ext = None
for src in map(str, source):
my_ext = SCons.Util.splitext(src)[1]
t_from_s = slist[0].target_from_source
except AttributeError:
raise UserError("Do not know how to create a target from source `%s'" % slist[0])
- splitext = lambda S,self=self,env=env: self.splitext(S,env)
- tlist = [ t_from_s(pre, suf, splitext) ]
+ except IndexError:
+ tlist = []
+ else:
+ splitext = lambda S,self=self,env=env: self.splitext(S,env)
+ tlist = [ t_from_s(pre, suf, splitext) ]
else:
target = _adjustixes(target, pre, suf)
tlist = env.arg2nodes(target, self.target_factory)
target_factory=MyNode,
source_factory=MyNode)
+ tgt = builder(env, source=[])
+ assert tgt == [], tgt
+
n1 = MyNode("n1")
n2 = MyNode("n2")
builder(env, target = n1, source = n2)
env = Environment()
builder = SCons.Builder.Builder(action = function2)
+
+ tgts = builder(env, source=[])
+ assert tgts == [], tgts
+
tgts = builder(env, target = [outfile, outfile2], source = 'foo')
for t in tgts:
t.prepare()
src_builder = builder1,
src_suffix = '.foo')
+ tgt = builder2(env, source=[])
+ assert tgt == [], tgt
+
tgt = builder2(env, target='baz',
source=['test.bar', 'test2.foo', 'test3.txt'])[0]
assert str(tgt.sources[0]) == 'test.foo', str(tgt.sources[0])
'.bar' : func_action,
'$BAR_SUFFIX' : func_action,
'$FOO_SUFFIX' : func_action })
+
+ tgt = builder(env, source=[])
+ assert tgt == [], tgt
assert isinstance(builder, SCons.Builder.CompositeBuilder)
assert isinstance(builder.action, SCons.Action.CommandGeneratorAction)
+
tgt = builder(env, target='test1', source='test1.foo')[0]
assert isinstance(tgt.builder, SCons.Builder.BuilderBase)
assert tgt.builder.action is builder.action
+
tgt = builder(env, target='test2', source='test1.bar')[0]
assert isinstance(tgt.builder, SCons.Builder.BuilderBase)
assert tgt.builder.action is builder.action
+
flag = 0
tgt = builder(env, target='test3', source=['test2.bar', 'test1.foo'])[0]
try: