Skip to content

Commit 13633f5

Browse files
committed
Set PYTHONEXECUTABLE to be the runfiles interpreter path
1 parent 42d6008 commit 13633f5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

py/tools/py/src/activate.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ deactivate nondestructive
6161
VIRTUAL_ENV="$(dirname "$(dirname "${BASH_SOURCE}")")"
6262
export VIRTUAL_ENV
6363

64+
# HACK: (Ab)use the MacOS $PYTHONEXECUTABLE to record the `.runfiles`-relative
65+
# interpreter path. This helps us avoid issues with the interpreter's path being
66+
# `realpath`-ed in such a way that it escapes the `.runfiles` tree.
67+
PYTHONEXECUTABLE="${VIRTUAL_ENV}/bin/python"
68+
export PYTHONEXECUTABLE
69+
6470
# unset PYTHONHOME if set
6571
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
6672
# could use `if (set -u; : $PYTHONHOME) ;` in bash.

0 commit comments

Comments
 (0)