pyenv/pyenv.d/exec/pip-rehash/conda
Andrew Rabert 0f596d2504 Revert "Merge pull request #1153 from cmcginty/remove-sbang"
This reverts commit 070e1c859f, reversing
changes made to 3faeda67bb.
2019-04-23 10:23:33 -04:00

29 lines
711 B
Bash
Executable file

#!/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}"
PYENV_COMMAND_PATH="$(pyenv-which "${PYENV_REHASH_REAL_COMMAND}")"
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
case "$1" in
"install" | "remove" | "uninstall") pyenv-rehash;;
esac
fi
exit "$STATUS"