mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
shims: handle symlinked scripts, via new PYENV_FILE_ARG
`PYENV_FILE_ARG` is used here to make use of `abs_dirname` later in `libexec/pyenv`. Fixes https://github.com/yyuu/pyenv/issues/404
This commit is contained in:
parent
af438abeae
commit
493f036928
2 changed files with 14 additions and 1 deletions
|
@ -54,6 +54,19 @@ else
|
|||
fi
|
||||
export PYENV_ROOT
|
||||
|
||||
# Transfer PYENV_FILE_ARG (from shims) into PYENV_DIR.
|
||||
if [ -z "${PYENV_DIR}" ]; then
|
||||
if [ -n "${PYENV_FILE_ARG}" ]; then
|
||||
if [ -L "${PYENV_FILE_ARG}" ]; then
|
||||
PYENV_DIR="$(abs_dirname "${PYENV_FILE_ARG}")"
|
||||
else
|
||||
PYENV_DIR="${PYENV_FILE_ARG%/*}"
|
||||
fi
|
||||
export PYENV_DIR
|
||||
unset PYENV_FILE_ARG
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${PYENV_DIR}" ]; then
|
||||
PYENV_DIR="$(pwd)"
|
||||
else
|
||||
|
|
|
@ -52,7 +52,7 @@ if [[ "\$program" = "python"* ]]; then
|
|||
-c* | -- ) break ;;
|
||||
*/* )
|
||||
if [ -f "\$arg" ]; then
|
||||
export PYENV_DIR="\${arg%/*}"
|
||||
export PYENV_FILE_ARG="\$arg"
|
||||
break
|
||||
fi
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue