mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-16 15:33:51 -05:00
shell version set in activate should be unset in deactivate (#61)
This commit is contained in:
@@ -41,8 +41,9 @@ while [ $# -gt 0 ]; do
|
||||
shift 1
|
||||
done
|
||||
|
||||
no_shell=
|
||||
versions=("$@")
|
||||
if [ -z "$versions" ]; then
|
||||
if [ -z "${versions}" ]; then
|
||||
no_shell=1
|
||||
OLDIFS="$IFS"
|
||||
IFS=: versions=($(pyenv-version-name))
|
||||
@@ -97,6 +98,16 @@ fi
|
||||
|
||||
if [ -z "$no_shell" ]; then
|
||||
echo "pyenv shell \"${versions}\";"
|
||||
# shell version set in pyenv-sh-activate should be unset
|
||||
# https://github.com/yyuu/pyenv-virtualenv/issues/61
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo "setenv PYENV_ACTIVATE_SHELL 1;"
|
||||
;;
|
||||
* )
|
||||
echo "export PYENV_ACTIVATE_SHELL=1;"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
prefix="$(pyenv-prefix "${versions}")"
|
||||
|
||||
@@ -43,10 +43,18 @@ if [ -n "$VERBOSE" ]; then
|
||||
echo " echo \"pyenv-virtualenv: deactivate ${prefix##*/}\" 1>&2;"
|
||||
fi
|
||||
|
||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||
# Backward compatibility issue
|
||||
# https://github.com/yyuu/pyenv-virtualenv/issues/26
|
||||
if [ -n "${PYENV_ACTIVATE_SHELL}" ]; then
|
||||
# shell version set in pyenv-sh-activate should be unset
|
||||
# https://github.com/yyuu/pyenv-virtualenv/issues/61
|
||||
echo " pyenv shell --unset;"
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo " set -e PYENV_ACTIVATE_SHELL;"
|
||||
;;
|
||||
* )
|
||||
echo " unset PYENV_ACTIVATE_SHELL;"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
case "$shell" in
|
||||
|
||||
Reference in New Issue
Block a user