[Scons-users] `__lib_either_version_flag` returning `None` triggers `NameError`
Mats Wichmann
mats at wichmann.us
Sun Apr 14 13:24:15 EDT 2024
On 4/14/24 11:04, Sye van der Veen wrote:
> I call `SetAllowableExceptions()` in my build files to ensure that I set
> all applicable build variables for my targets. I then set variables I
> don't currently need to the empty string, to avoid the resulting
> `NameError`s.
>
> After a recent update to Scons 4.7.0, I was getting a `NameError`
> stating that `__libversionflags` was undefined. This variable is
> implemented as a function, and the docstring states: `if version_var is
> not empty, returns env[flags_var], otherwise returns None`.
...
> I propose that `__libversionflags` be modified to return the empty
> string if `version_var` is empty. Note that a similar issue exists for
> `__lib_either_version_flag` in the same file; I propose the same change
> here too.
The change is obviously simple enough, like:
@@ -690,7 +690,7 @@ def __libversionflags(env, version_var, flags_var):
"""
try:
if env.subst('$' + version_var):
- return env[flags_var]
+ return env.get(flags_var, "")
except KeyError:
pass
return None
But curious why it specifically is documented to return None in this
case, and what's changed to cause you a problem - the code doesn't look
to have been been changed in this area for several years. What version
were you running where this didn't cause problems? (consider this the
investigative phase :-) )
More information about the Scons-users
mailing list