Skip to content

Avoid fast-path in --sh-boot script when PEX_TOOLS=1 #2726

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

Merged
merged 4 commits into from
Mar 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pex/sh_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,11 @@ def create_sh_boot_script(
PEX_ROOT="${{PEX_ROOT:-${{DEFAULT_PEX_ROOT}}}}"
INSTALLED_PEX="${{PEX_ROOT}}/{pex_installed_relpath}"

if [ -n "${{VENV}}" -a -x "${{INSTALLED_PEX}}" ]; then
if [ -n "${{VENV}}" -a -x "${{INSTALLED_PEX}}" -a "${{PEX_TOOLS:-}}" != "" ]; then
Copy link
Member

Choose a reason for hiding this comment

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

You inverted your logic here which the existing IT caught. Also maybe just use -z instead of = to be (anti)parallel with the -n logic at the front of the line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, yes 🤦

-z is much better. Thanks.

# We're a --venv execution mode PEX installed under the PEX_ROOT and the venv
# interpreter to use is embedded in the shebang of our venv pex script; so just
# execute that script directly.
# execute that script directly... except if we're needing to execute PEX code, in
# the form of the tools.
export PEX="{pex}"
exec "${{INSTALLED_PEX}}/bin/python" ${{VENV_PYTHON_ARGS}} "${{INSTALLED_PEX}}" \\
"$@"
Expand Down
Loading