-
Notifications
You must be signed in to change notification settings - Fork 420
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
Properly handle parsing of equals in chplconfig #26182
Conversation
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
Signed-off-by: Jade Abraham <[email protected]>
|
||
parts = line.split('=', maxsplit=1) | ||
var = parts[0].strip() | ||
val = parts[-1].strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking about how you can silence the warning if there's a leading equal sign in a variable for real, and I'm coming up with nothing. I don't think you should strip the string for the purposes of warning about it. So:
A==B # warns
A == B # warns
A = =B # doesn't warn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was an intentional choice that A = = B
still warns. I think its more likely to be a mistake than truly what a user wants. If they want a value to start with =
, writing A = '= B'
should work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as there's a way to silence the warning (A='=B' seems like it is one), I'm happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... Mind adding a test for A = '= B'?
Signed-off-by: Jade Abraham <[email protected]>
Properly handles the parsing of chplconfig files. #26178 added the ability to parse chplconfig variables with values including
=
, but that broke the warning for something likeCHPL_VAR==value
.This PR resolves the issue by refactoring some of the parsing code in
overrides.py
to check error cases inskip_line
, rather than relying on python exceptions. Then to avoid duplication of logic, renamesskip_line
tocheck_line
and has it return the parsed variable.Fixes the issue introduced in #26178 and reverts #26180
Tested by running
start_test test/chplenv
[Reviewed by @DanilaFe]