mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
39 lines
719 B
Bash
Executable File
39 lines
719 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Summary: Deactivate virtual environment
|
|
#
|
|
# Usage: pyenv deactivate
|
|
#
|
|
# Deactivate a Python virtual environment.
|
|
|
|
set -e
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
|
case "$shell" in
|
|
fish )
|
|
cat <<EOS
|
|
if functions -q deactivate
|
|
setenv PYENV_DEACTIVATE "\$PYENV_ACTIVATE";
|
|
set -e PYENV_ACTIVATE;
|
|
deactivate;
|
|
end;
|
|
EOS
|
|
;;
|
|
* )
|
|
cat <<EOS
|
|
if declare -f deactivate 1>/dev/null 2>&1; then
|
|
export PYENV_DEACTIVATE="\$PYENV_ACTIVATE";
|
|
unset PYENV_ACTIVATE;
|
|
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
|