mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-14 14:33:52 -05:00
Unset shell version only if the deactivate has invoked
This commit is contained in:
@@ -10,10 +10,24 @@ set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||
case "$shell" in
|
||||
fish )
|
||||
echo "if functions -q deactivate"
|
||||
;;
|
||||
* )
|
||||
echo "if declare -f deactivate 1>/dev/null 2>&1; then"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||
# Backward compatibility issue
|
||||
# https://github.com/yyuu/pyenv-virtualenv/issues/26
|
||||
echo " pyenv shell --unset;"
|
||||
fi
|
||||
|
||||
case "$shell" in
|
||||
fish )
|
||||
cat <<EOS
|
||||
if functions -q deactivate
|
||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
||||
deactivate;
|
||||
end;
|
||||
@@ -21,16 +35,9 @@ 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;"
|
||||
fi
|
||||
|
||||
@@ -28,10 +28,10 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
if declare -f deactivate 1>/dev/null 2>&1; then
|
||||
pyenv shell --unset;
|
||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
||||
deactivate;
|
||||
fi;
|
||||
pyenv shell --unset;
|
||||
EOS
|
||||
}
|
||||
|
||||
@@ -57,10 +57,10 @@ EOS
|
||||
assert_success
|
||||
assert_output <<EOS
|
||||
if functions -q deactivate
|
||||
pyenv shell --unset;
|
||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
||||
deactivate;
|
||||
end;
|
||||
pyenv shell --unset;
|
||||
EOS
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user