-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Change Variables() such that you can disable subst()'ing before running converter or validator #4241
Comments
RFI: I can't follow that link (get lost in the morass of trying to vector through the web browser to authenticate before being allowed to see, which no longer works for me), could we add a detail for
|
Here's the discord thread content: acm — 10/11/2022 1:59 PM bdbaddog — 10/11/2022 2:18 PM bdbaddog — 10/11/2022 2:35 PM acm — 10/11/2022 2:44 PM bdbaddog — 10/11/2022 2:49 PM acm — 10/11/2022 2:51 PM That would have worked, except that RPATH has a converter bdbaddog — 10/11/2022 3:02 PM acm — 10/11/2022 3:04 PM bdbaddog — 10/11/2022 3:06 PM bdbaddog — 10/11/2022 3:25 PM |
that's useful, thanks. Somehow I'm not surprised the always beloved |
Okay, to pick this bit:
The design overall is a little awkward. Despite what the manpage says, the rough order is:
Calling subst before passing to the validator is how it fetches the updated value saved by calling the converter, but you could just get the raw value via Is there something actionable in this issue? |
Sure. I think a subst=True/False on Variable, with default of True would work? |
Yeah, probably. After "sleeping on it", I don't get the value of
|
And... a quick check shows that the tests do expect the value to be subst'd, specifically for PathVariable('qtdir', 'where the root of Qt is installed', qtdir),
PathVariable('qt_libraries', 'where the Qt library is installed', os.path.join('$qtdir', 'lib')) But it's not hard for validators that need substitution to do it themselves, if one wanted to go that way. Edit: incomplete info. |
Going back to an earlier comment:
This is easy to do - I have a prototype - but after reading an article entitled roughly "The Boolean Trap", one wonders if a string value is better, to allow for possible future flexibility. One could imagine, without having use cases in hand, that controlling whether both converter and validator subst or not might be interesting; or the type of subst (the subst module intself defines those three styles - More importantly: is this actually worth doing? |
I think bool is sufficient. If we really found we needed more flexibility then we could complicate the solution more.. |
New parameter do_subst added to the variables Add method, if false indicates the variable value should not be substituted by the Variables logic. The default is True. Fixes SCons#4241. Signed-off-by: Mats Wichmann <mats@linux.com>
New parameter do_subst added to the variables Add method, if false indicates the variable value should not be substituted by the Variables logic. The default is True. Fixes SCons#4241. Signed-off-by: Mats Wichmann <mats@linux.com>
Fix ListVariable handling of a quoted variable value containing spaces. As a side effect of splitting the former monolithic converter/validator for ListVariable into separate callbacks, it became possible for subst to be called twice. The ListVariable converter produces an instance of a _ListVariable container, and running subst on that result ends up losing information, so avoid doing so. While developing a test for this, it turned out the test framework also didn't handle a quoted argument containing a space, so that a test case passing arguments to scons via "run(arguments='...')" could end up with scons seeing a different (broken) command line than scons invoked with the same arguments typing to a shell prompt. A regex is now used to more accurately split the "arguments" parameter, and a unit test was added to the framework tests to validate. The framework fix had a side effect - it was possible that when run as part of the test suite, the Variables package could receive a value still wrapped in quotes, leading to string mismatches ('"with space"' is not equal to 'with space'), so ListVariable now strips wrapping quote marks. Also during testing it turned out that the earlier fix for SCons#4241, allowing a Variable to declare the value should not be subst'd, introduced problems for two types which assumed they would always be passed a string. With subst=False, they could be passed a default value that had been specified as a bool. Fixed to not fail on that. Fixes SCons#4585 Signed-off-by: Mats Wichmann <mats@linux.com>
Currently, the logic for Variables will subst the passed value for a variable before running the converter and validator (per each if specified). This isn't always desirable. Suggest add a flag or other way to disable one or both of those substs
Required information
4.4.0
N/A
Discord discussion:
https://discord.com/channels/571796279483564041/1029498487156527114
The text was updated successfully, but these errors were encountered: