-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
Transform scopes in pants.ini that have been subsumed by global options. #5007
Conversation
src/python/pants/option/config.py
Outdated
from pants.util.eval import parse_expression | ||
from pants.util.meta import AbstractClass | ||
|
||
|
||
GLOBAL_SECTION = 'GLOBAL' |
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.
Should this just use from pants.option.arg_splitter import GLOBAL_SCOPE_CONFIG_SECTION
? It looks like that introduces no circular deps.
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.
sure, done.
def is_valid_option(prefix, option, valid_options_under_scope): | ||
if option in valid_options_under_scope: | ||
return True | ||
if prefix and '_'.join((prefix, option)) in valid_options_under_scope: |
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.
Just passing through, but I'm confused by this bit. Is there a test for the prefix addition cases here? Can prefixes include .
s and -
s?
Also, this has the consequence of allowing options prefixed with their section name to elide the section name. For example, the ivy subsystem has --ivy-settings and --ivy-profile declared as options. With this change pants.ini can refer to them as either ivy_settings:
and ivy_profile:
or as settings:
and profile:
, without the prefix.
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.
fixed.
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.
Thanks!
error_log = [] | ||
global_scopes = ( | ||
# Consider inherited scopes when verifying options. |
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.
s/inherited/subsumed/ ? You're not considering all inherited scopes (which would be all scopes).
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.
Now that I think of it, why is this necessary? Haven't we already transformed the config so it looks as if these options are in the global section?
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.
yeah, this is a remnant of an earlier approach - no longer needed and yanked.
Fixes #4917