-
|
Look at following file: import SCons
from SCons.Variables import *
env = Environment()
options = Variables()
def validator(key, val, env):
raise SCons.Errors.UserError(f"validator: {key} {val}") from None
def converter(val):
return False
options.Add("my_option", validator=validator, converter=converter)
options.Update(env)
print(options.GenerateHelpText(env))
print(options)There is only option name passed aside converter and validator. Run `scons my_option="no". The code prints following: Here we see that it ignored validator and converter but if you will change the option from - options.Add("my_option", validator=validator, converter=converter)
+ options.Add("my_option", "help", "default", validator=validator, converter=converter)It will print as it should Is it known? Should I convert it to issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Due to lack of a default, meaning |
Beta Was this translation helpful? Give feedback.
-
|
This didn't turn out to be what I expected. Remove the star import from |
Beta Was this translation helpful? Give feedback.
This didn't turn out to be what I expected. Remove the star import from
Variables- the publicly exposed (from an SConscript viewpoint)Variablesis a function in the main part of the program (SCons.Script), which instantiates theVariablesclass with appropriate defaults. The star import overwrites that function with the symbol (class name) fromSCons.Variables, so you get the wrong one, and in fact, the Variables package doesn't end up seeing your command-line argument.