File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change 5757# detecting virtualenvs like normal (i.e. using the venv symlink to find the
5858# real interpreter). To work around this, we have to manually detect the venv,
5959# then trick the interpreter into understanding we're in a virtual env.
60- self_dir=$( dirname $0 )
61- if [[ -e " $self_dir /pyvenv.cfg" || -e " $self_dir /../pyvenv.cfg" ]]; then
62- if [[ " $0 " == /* ]]; then
63- venv_bin=" $0 "
64- else
65- venv_bin=" $PWD /$0 "
66- fi
60+ self_dir=$( dirname " $0 " )
61+ if [ -e " $self_dir /pyvenv.cfg" ] || [ -e " $self_dir /../pyvenv.cfg" ]; then
62+ case " $0 " in
63+ /* )
64+ venv_bin=" $0 "
65+ ;;
66+ * )
67+ venv_bin=" $PWD /$0 "
68+ ;;
69+ esac
6770
6871 # PYTHONEXECUTABLE is also used because `exec -a` doesn't fully trick the
6972 # pyenv wrappers.
7073 # NOTE: The PYTHONEXECUTABLE envvar only works for non-Mac starting in Python 3.11
7174 export PYTHONEXECUTABLE=" $venv_bin "
7275 # Python looks at argv[0] to determine sys.executable, so use exec -a
7376 # to make it think it's the venv's binary, not the actual one invoked.
77+ # NOTE: exec -a isn't strictly posix-compatible, but very widespread
7478 exec -a " $venv_bin " " $PYTHON_BIN " " $@ "
7579else
7680 exec " $PYTHON_BIN " " $@ "
You can’t perform that action at this time.
0 commit comments