`__lib_either_version_flag` returning `None` triggers `NameError`
Sye van der Veen <[email protected]> Sun, 14 Apr 2024 13:04:45 -0400
| Newsgroups | gmane.comp.programming.tools.scons.user |
|---|---|
| Message-ID | <CA+No7BTxthz8=sHxVH8cH=1e95rOWhnCho1OkvWu8rVOx=TD1A@mail.gmail.com> |
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`.
https://github.com/SCons/scons/blob/5dd1d9cea01dd639604b6a4cad911ff8437bd961/SCons/Defaults.py#L683
`__libversionflags` is used in `__SHLIBVERSIONFLAGS` and other variables:
```
'__SHLIBVERSIONFLAGS':
'${__libversionflags(__env__,"SHLIBVERSION","_SHLIBVERSIONFLAGS")}'
```
I do not require versioned shared libraries for this particular build, so I
have set ` SHLIBVERSION` to the empty string, which does not trigger a
`NameError`. Unfortunately, this causes `__libversionflags` to return
`None`, which is interpreted as an undefined variable, thus raising a
`NameError`:
https://github.com/SCons/scons/blob/5dd1d9cea01dd639604b6a4cad911ff8437bd961/SCons/Subst.py#L394
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.
Thank you,
Sye van der Veen
_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users