[Scons-users] Variable substitution special modifiers do not appear to work with callables

Andrew C. Morrow andrew.c.morrow at gmail.com
Sat May 16 14:45:30 EDT 2015


With SCons 2.3.4, the following SConstruct (reduced from a much larger
system, so is somewhat arbitrary), unexpectedly fails with an error:

> cat SConstruct

def generator(target, source, env, for_signature):
    return 'generated'

env = Environment(
    XXX=generator,
)

env.Command(
    target='${XXX}',
    source=[],
    action="touch $TARGET",
)

env.Command(
    target='something',
    source=['${XXX}'],
    # I know this could use SOURCE instead of XXX, but
    # using XXX is the point of the example.
    action="cat ${XXX.abspath} > $TARGET",
)

> scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
touch generated
scons: *** [something] AttributeError `'function' object has no attribute
'abspath'' trying to evaluate `${XXX.abspath}'
scons: building terminated because of errors.

Based on my reading of the Variable Substitution part of the SCons man
page, I would expect that the abspath special modifier would work on any
variable, but it seems it does not work when the variable is callable.

Is this a bug, or is there a bit of syntactic magic I can apply to make
this work?

Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150516/362256f1/attachment.html>


More information about the Scons-users mailing list