Use PYENV_DEACTIVATE to store which virtualenv has been deactivated (#32)

This commit is contained in:
Yamashita Yuu
2014-06-30 22:40:59 +09:00
parent 7079cbe979
commit 08b4c94f85
6 changed files with 169 additions and 72 deletions

View File

@@ -11,12 +11,26 @@ set -e
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
case "$shell" in
fish ) echo "functions -q deactivate; and deactivate;";;
* ) echo "declare -f deactivate 1>/dev/null 2>&1 && deactivate;";;
fish )
cat <<EOS
if functions -q deactivate
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
deactivate;
end;
EOS
;;
* )
cat <<EOS
if declare -f deactivate 1>/dev/null 2>&1; then
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
deactivate;
fi;
EOS
;;
esac
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
# Backward compatibility issue
# https://github.com/yyuu/pyenv-virtualenv/issues/26
echo "pyenv shell --unset"
echo "pyenv shell --unset;"
fi