2014-12-01 08:34:02 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
|
|
|
|
# Remove pyenv-pip-rehash/libexec from PATH to avoid infinite loops in `pyenv-which` (yyuu/pyenv#146)
|
|
|
|
_PATH=":${PATH}:"
|
|
|
|
_HERE="$(dirname "${BASH_SOURCE[0]}")" # remove this from PATH
|
|
|
|
_PATH="${_PATH//:${_HERE}:/:}"
|
|
|
|
_PATH="${_PATH#:}"
|
|
|
|
_PATH="${_PATH%:}"
|
|
|
|
PATH="${_PATH}"
|
|
|
|
|
2015-04-29 07:53:46 -04:00
|
|
|
PYENV_COMMAND_PATH="$(pyenv-which "${PYENV_REHASH_REAL_COMMAND}")"
|
2014-12-01 08:34:02 -05:00
|
|
|
PYENV_BIN_PATH="${PYENV_COMMAND_PATH%/*}"
|
|
|
|
|
|
|
|
export PATH="${PYENV_BIN_PATH}:${PATH}"
|
|
|
|
|
|
|
|
STATUS=0
|
|
|
|
"$PYENV_COMMAND_PATH" "$@" || STATUS="$?"
|
|
|
|
|
|
|
|
# Run `pyenv-rehash` after a successful installation.
|
|
|
|
if [ "$STATUS" == "0" ]; then
|
2017-05-09 06:43:51 -04:00
|
|
|
for piparg in "$@"; do
|
|
|
|
case ${piparg} in
|
|
|
|
"install" | "uninstall" ) REHASH=0;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$REHASH" == "0" ]; then
|
|
|
|
pyenv-rehash
|
2014-12-01 08:34:02 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
exit "$STATUS"
|