Skip to content
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

Merged
merged 11 commits into from
Oct 23, 2017

Conversation

kwlzn
Copy link
Member

@kwlzn kwlzn commented Oct 20, 2017

Fixes #4917

from pants.util.eval import parse_expression
from pants.util.meta import AbstractClass


GLOBAL_SECTION = 'GLOBAL'
Copy link
Contributor

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.

Copy link
Member Author

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:
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

Copy link
Contributor

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.
Copy link
Sponsor Contributor

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).

Copy link
Sponsor Contributor

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?

Copy link
Member Author

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.

@kwlzn kwlzn merged commit 9648311 into pantsbuild:master Oct 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants