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

Re-exec with interpreter-options when set. (#1745) #1746

Merged
merged 1 commit into from
May 3, 2022

Conversation

BrandonTheBuilder
Copy link
Contributor

Parse options args for interpreter options. If they are present re-exec passing the proper options to the interpreter. If they are not present run the code directly.

Copy link
Member

@jsirois jsirois left a comment

Choose a reason for hiding this comment

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

Thanks Loren. I really appreciate you stopping by at PyCon and chipping in. The comments are not worth addressing unless there is a natural opportunity like CI failures. I'll merge if all is green.

Restart the process passing the given options to the python interpreter
"""
# Find the pex bootstrap location
# We expect this environment variable to be set by __main__.py
Copy link
Member

Choose a reason for hiding this comment

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

This comment is a bit stale and needs adjustment.

)
os.execv(interpreter, cmdline)
else:
return "Unable to resolve pex path"
Copy link
Member

Choose a reason for hiding this comment

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

This should be impossible; so its not very important except for the code reader, but it would be spot on if it said "Unable to resolve installed pex path".

@jsirois jsirois merged commit 098e5ff into pex-tool:main May 3, 2022
jsirois added a commit to jsirois/pex that referenced this pull request May 4, 2022
Apply @BrandonTheBuilder's work in pex-tool#1746 to the `--venv` case and flesh
out complete support for Python interpreter emulation by adding `.` to
the `sys.path` when running as an interpreter and handling interpreter
execution of directories.

Fixes pex-tool#1745
jsirois added a commit to jsirois/pex that referenced this pull request May 4, 2022
Apply @BrandonTheBuilder's work in pex-tool#1746 to the `--venv` case and flesh
out complete support for Python interpreter emulation by adding `.` to
the `sys.path` when running as an interpreter and handling interpreter
execution of directories.

Fixes pex-tool#1745
jsirois added a commit that referenced this pull request May 4, 2022
Apply @BrandonTheBuilder's work in #1746 to the `--venv` case and flesh
out complete support for Python interpreter emulation by adding `.` to
the `sys.path` when running as an interpreter and handling interpreter
execution of directories.

Fixes #1745
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