mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-14 22:43: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
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
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
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if functions -q deactivate
|
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
end;
|
end;
|
||||||
@@ -21,16 +35,9 @@ EOS
|
|||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if declare -f deactivate 1>/dev/null 2>&1; then
|
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
fi;
|
fi;
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
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_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if declare -f deactivate 1>/dev/null 2>&1; then
|
if declare -f deactivate 1>/dev/null 2>&1; then
|
||||||
|
pyenv shell --unset;
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
fi;
|
fi;
|
||||||
pyenv shell --unset;
|
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +57,10 @@ EOS
|
|||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if functions -q deactivate
|
if functions -q deactivate
|
||||||
|
pyenv shell --unset;
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
end;
|
end;
|
||||||
pyenv shell --unset;
|
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user