-
Hello I've just thought about expansion and want to know if following code is reliable and deterministic. import SCons
from SCons.Variables import *
env = Environment()
options = Variables(["custom.py"], ARGUMENTS)
options.Add("my_option", "", "some_string")
options.Add("my_option2", "", "$my_option/${2+3}")
options.Update(env)
print(options.GenerateHelpText(env)) Following code prints as expected:
But inside docs I saw following https://scons.org/doc/production/HTML/scons-user.html#b-Substfile that |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Sorry, never commented on this... I think the In the case of Variables, ones that come from a file are processed by doing an So there seem to be plenty of ways for substitution not to happen on the value/default of a variable... |
Beta Was this translation helpful? Give feedback.
Sorry, never commented on this... I think the
Substfile
wording in the User Guide you point to is a remnant of when Python dicts were not order-preserving.In the case of Variables, ones that come from a file are processed by doing an
exec
on the script as if it were Python code, so that behavior should be well-known; nothing particular is done up front for values that come from the command line. Then, once a declared variable has a value, if it has a converter it is substituted before the converter is called; if it has a validator it may be substituted, depending on the type of the value - both also controlled by a flag which can be set to not do substitution (that's because of a specifi…