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

Honor PEX_IGNORE_RCFILES in to_python_interpreter() #673

Merged
merged 2 commits into from Feb 15, 2019

Conversation

blorente
Copy link
Contributor

Currently, it will try to resolve a path to an interpreter in PEX_PYTHON_PATH even if PEX_IGNORE_RCFILES is set.

rc_variables = Variables.from_rc(rc=options.rc_file)
pex_python_path = rc_variables.get('PEX_PYTHON_PATH', '')
if not ENV.PEX_IGNORE_RCFILES:
rc_variables = Variables.from_rc(rc=options.rc_file)
Copy link
Member

Choose a reason for hiding this comment

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

The options.rc_file value is None by default. To be non-None pex had to be invoked from the cli with --rcfile=[path]. As such you're setting the precedent rule here of env beats flags. That does not seem kosher. Is that what you're intending here or have I read things wrong?

Copy link
Member

@jsirois jsirois Feb 15, 2019

Choose a reason for hiding this comment

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

Honestly, the flag really makes no sense. It shouldn't exist at all fwict. I'd be fine with considering this not your problem. I've filed #674

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if the option is None, Variable.from_rc will try to load stuff from well-known files (i.e. /etc/pexrc, ~/.pexrc...), which leaves us with no way of specifying here "I actually want you to ignore all pexrc files".

Copy link
Member

Choose a reason for hiding this comment

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

Well, the condition could be if options.rc_file or not ENV.PEX_IGNORE_RCFILES.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I'd still like a way of expressing "Please do not try to load pexrc files", so would you be okay with something like "If the flag is None, and the env variable PEX_IGNORE_RCFILES is set, please do not load any pexrc file? That would create slightly inconsistent semantics for the env variable, until the flag is removed.

Copy link
Member

Choose a reason for hiding this comment

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

Yes. I think we're saying the same thing. SGTM.

@jsirois
Copy link
Member

jsirois commented Feb 15, 2019

@CMLivingston can you provide any guidance here navigating the tangle between options.rc_file, PEX_IGNORE_RCFILES and Using ENV everywhere else and Variables directly here? This all needs straightening and crisping even if it doesn't happen in this PR.

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.

None yet

2 participants