-
-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppendUnique breaks CPPScanner when using defs without value #4108
Comments
Looks like it's easy enough to patch the hole here, without necessarily tackling the deeper question of why we have keep converting the type of CPPDEFINES. Do you have a simple example that actually tickles the Meanwhile, /me scratches head over: env = Environment()
env.Append(CPPDEFINES="A")
env.Append(CPPDEFINES="B=C")
env.Append(CPPDEFINES=["STM32F4"])
env.AppendUnique(CPPDEFINES=["STM32F4"]) Showing
as in - why does Append's speciai-case handling for CPPDEFINES not tuple-ify and AppendUnique's does? |
I think
I think more proper example of difference would be to |
Indeed, it is... from SCons.Scanner.C import dictify_CPPDEFINES
d = dictify_CPPDEFINES(env) |
In converting CPPDEFINES to a dict, if an element is a single-item sequence c, it would take an IndexError trying to access c[1]. This could happen if AppendUnique has been called as it converts to tuples. Fixes SCons#4108 Signed-off-by: Mats Wichmann <mats@linux.com>
AppendUnique
turns string values into tuples with single values, breakingdictify_CPPDEFINES
, and thus CPPScanner.Details of my investigation here: https://community.platformio.org/t/libraries-included-inside-conditional-guard-are-still-added-to-the-dep-graph-by-ldf/26326/4
-DA -DB=C into ('A', ('B', 'C'))
forenv[“CPPDEFINES”]
libopencm3.py
script tries to add-DSTM32F4
def viaenv.ApppendUnique(CPPDEFINES=["STM32F4"])
(which is not really necessary, but that’s irrelevant)env.AppendUnique
turns all previous defs without value (that were strings) into tuples with single value, and adds new values also as tuples:(('A', ), ('B', 'C'), ('STM32F4',))
env.AppendUnique
breaks that expectationRequired information
The text was updated successfully, but these errors were encountered: