[Scons-users] matching source and target's behavior between func and cmd actions

daggs daggs at gmx.com
Sat Jun 20 05:19:04 EDT 2020


Greetings.

given this example:
def task(source, target, env):
	print('S1: %s T1: %s' % (source[0], target[0]))

bld = Builder(action = '@echo S: $SOURCES.abspath T: $TARGET.abspath')
bld1 = Builder(action = task)

env = Environment(BUILDERS = {'Foo' : bld, 'Foo1' : bld1})

env.Foo('a/vb/c/aaa',['/dev/null','v','b'])
env.Foo1('a/vb/c/aaa1',['/dev/null','v','b'])

which produces this output:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
S: /dev/null /tmp/test/v /tmp/test/b T: /tmp/test/a/vb/c/aaa
task(["a/vb/c/aaa1"], ["/dev/null", "v", "b"])
S1: /dev/null T1: a/vb/c/aaa1
scons: done building targets.

is there a simple way to change bld1 to behave the same as bld?
I'd assume this can be done using **kwargs but it seems like it won't be simple

Thanks,

Dagg.


More information about the Scons-users mailing list