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

Harden PythonInterpreter agains pyenv shims. #860

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Jan 23, 2020

Previously, Pex encounered hard to diagnose errors when selected
interpreters were pyenv shims. These shim files can represent a
different interpreter on different executions which broke Pex's
assumption that a given binary always corresponded to a given python
version.

Since we already shell out to an interpreter to gather its
PythonIdentity, we now include collecting the real final interpeter
path from sys.executable there. This allows pex to see through a shim
to the underlying $PYENV_ROOT/versions/<version>/bin/python*
interpreter which conforms to the expectation of a given binary
corresponding to a given python version.

See: pyenv/pyenv#1112

Debugged working #856 which hit otherwise un-explainable errors in
tests/test_pex_bootstrapper.py.

Work towards #782.

Previously, Pex encounered hard to diagnose errors when selected
interpreters were pyenv shims. These shim files can represent a
different interpreter on different executions which broke Pex's
assumption that a given binary always corresponded to a given python
version.

Since we already shell out to an interpreter to gather its
`PythonIdentity`, we now include collecting the real final interpeter
path from `sys.executable` there. This allows pex to see through a shim
to the underlying `$PYENV_ROOT/versions/<version>/bin/python*`
interpreter which conforms to the expectation of a given binary
corresponding to a given python version.

See: pyenv/pyenv#1112

Debugged working pex-tool#856 which hit otherwise un-explainable errors in
`tests/test_pex_bootstrapper.py`.

Work towards pex-tool#782.
@jsirois jsirois merged commit e02ea4a into pex-tool:master Jan 23, 2020
@jsirois jsirois deleted the issues/782/pyenv-shim-harden branch January 23, 2020 15:16
jsirois added a commit to jsirois/pex that referenced this pull request Oct 9, 2020
The prior fix for pex-tool#1009 undid the fix in pex-tool#860. Re-enable that fix
for any case that's clearly not in the context of a macOS Framework
Python build. Also add tests for pyenv shims to prevent further
regressions.
jsirois added a commit that referenced this pull request Oct 9, 2020
The prior fix for #1009 undid the fix in #860. Re-enable that fix
for any case that's clearly not in the context of a macOS Framework
Python build. Also add tests for pyenv shims to prevent further
regressions.
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.

2 participants