[Scons-users] $TARGET and $SOURCE are Null in Substfile

xyz123 at quantentunnel.de xyz123 at quantentunnel.de
Thu May 24 04:12:41 EDT 2018


I'm sorry for the HTML-Format. Here again as plain text.

Dear scons-users,

I evaluated the Substfile builder.
I used a method for the substitution. However, I miss the values for the target and source parameters.

Here my example:

my_file.in:The source file is: @substitute_by_source_filename@


SConstruct:def get_source_filename(target, source, env, for_signature):

    return "{}".format(source)

env = Environment(tools=['textfile']
env['subst_by_source'] = get_source_filename

tgt = env.Substfile('my_file.in', SUBST_DICT={
    '@substitute_by_source_filename@':'${subst_by_source}'
    })


When I run this example 'target' and 'source' are of type <class 'SCons.Subst.NullNodeList'>.



Doing the following change fixes the issue.
Tool/textfile.py, around line 100:

            if callable(v):
                v = v()
            if is_String(v):
<                v = env.subst(v)
>                v = env.subst(v, target=target, source=source)
            else:
                v = str(v)
            subs.append((k,v))


I would like to know if 'target' and 'source' are omitted intentionally?


Thank you.


More information about the Scons-users mailing list