mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-08 11:33:55 -05:00
Display information on automatic (de)?activation
This commit is contained in:
@@ -14,23 +14,32 @@
|
|||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
# Provide pyenv completions
|
|
||||||
if [ "$1" = "--complete" ]; then
|
|
||||||
echo --unset
|
|
||||||
exec pyenv-virtualenvs --bare
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset NOERROR
|
unset NOERROR
|
||||||
|
unset VERBOSE
|
||||||
|
|
||||||
if [ "$1" = "--no-error" ]; then
|
while [ $# -gt 0 ]; do
|
||||||
NOERROR=1
|
case "$1" in
|
||||||
|
"--complete" )
|
||||||
|
# Provide pyenv completions
|
||||||
|
echo --unset
|
||||||
|
exec pyenv-virtualenvs --bare
|
||||||
|
;;
|
||||||
|
"--no-error" )
|
||||||
|
NOERROR=1
|
||||||
|
;;
|
||||||
|
"--unset" )
|
||||||
|
echo "pyenv deactivate"
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
"--verbose" )
|
||||||
|
VERBOSE=1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
shift 1
|
shift 1
|
||||||
fi
|
done
|
||||||
|
|
||||||
if [ "$1" = "--unset" ]; then
|
|
||||||
echo "pyenv deactivate"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
versions=("$@")
|
versions=("$@")
|
||||||
if [ -z "$versions" ]; then
|
if [ -z "$versions" ]; then
|
||||||
@@ -78,10 +87,12 @@ fish )
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Display setup instruction if 'pyenv virtualenv-init -' is not found in "$profile"
|
# Display setup instruction if 'pyenv virtualenv-init -' is not found in "$profile"
|
||||||
if [ -z "$NOERROR" ]; then
|
if [ -f "$profile" ] && grep -q 'pyenv init -' "$profile" && ! grep -q 'pyenv virtualenv-init -' "$profile"; then
|
||||||
if [ -f "$profile" ] && grep -q 'pyenv init -' "$profile" && ! grep -q 'pyenv virtualenv-init -' "$profile"; then
|
pyenv-virtualenv-init >&2 || true
|
||||||
pyenv-virtualenv-init >&2 || true
|
fi
|
||||||
fi
|
|
||||||
|
if [ -n "$VERBOSE" ]; then
|
||||||
|
echo "pyenv-virtualenv: activate ${versions}" 1>&2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$no_shell" ]; then
|
if [ -z "$no_shell" ]; then
|
||||||
|
|||||||
@@ -10,11 +10,22 @@ set -e
|
|||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
unset NOERROR
|
unset NOERROR
|
||||||
|
unset VERBOSE
|
||||||
|
|
||||||
if [ "$1" = "--no-error" ]; then
|
while [ $# -gt 0 ]; do
|
||||||
NOERROR=1
|
case "$1" in
|
||||||
|
"--no-error" )
|
||||||
|
NOERROR=1
|
||||||
|
;;
|
||||||
|
"--verbose" )
|
||||||
|
VERBOSE=1
|
||||||
|
;;
|
||||||
|
* )
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
shift 1
|
shift 1
|
||||||
fi
|
done
|
||||||
|
|
||||||
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
shell="$(basename "${PYENV_SHELL:-$SHELL}")"
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
@@ -26,6 +37,10 @@ fish )
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ -n "$VERBOSE" ]; then
|
||||||
|
echo " echo \"pyenv-virtualenv: deactivate ${VIRTUAL_ENV##*/}\" 1>&2;"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||||
# Backward compatibility issue
|
# Backward compatibility issue
|
||||||
# https://github.com/yyuu/pyenv-virtualenv/issues/26
|
# https://github.com/yyuu/pyenv-virtualenv/issues/26
|
||||||
@@ -35,14 +50,14 @@ fi
|
|||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@@ -77,16 +77,16 @@ fish )
|
|||||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||||
if [ -n "\$VIRTUAL_ENV" ]
|
if [ -n "\$VIRTUAL_ENV" ]
|
||||||
if [ (pyenv version-name) = "system" ]
|
if [ (pyenv version-name) = "system" ]
|
||||||
eval (pyenv sh-deactivate); or true
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-deactivate); or true
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
eval (pyenv sh-activate 2>/dev/null); or true
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
if [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-activate 2>/dev/null); or true
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -108,16 +108,16 @@ if [[ "$shell" != "fish" ]]; then
|
|||||||
cat <<EOS
|
cat <<EOS
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -27,6 +27,27 @@ source "${PYENV_ROOT}/versions/venv/bin/activate";
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "activate virtualenv from current version (verbose)" {
|
||||||
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
|
||||||
|
stub pyenv-version-name "echo venv"
|
||||||
|
stub pyenv-virtualenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||||
|
stub pyenv-prefix "venv : echo \"${PYENV_ROOT}/versions/venv\""
|
||||||
|
|
||||||
|
PYENV_SHELL="bash" PYENV_VERSION="venv" run pyenv-sh-activate --verbose
|
||||||
|
|
||||||
|
unstub pyenv-version-name
|
||||||
|
unstub pyenv-virtualenv-prefix
|
||||||
|
unstub pyenv-prefix
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
pyenv-virtualenv: activate venv
|
||||||
|
unset PYENV_DEACTIVATE;
|
||||||
|
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
|
||||||
@test "activate virtualenv from current version (without pyenv-virtualenv-init)" {
|
@test "activate virtualenv from current version (without pyenv-virtualenv-init)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,33 @@ setup() {
|
|||||||
|
|
||||||
@test "deactivate virtualenv" {
|
@test "deactivate virtualenv" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
||||||
|
|
||||||
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
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
|
deactivate;
|
||||||
|
else
|
||||||
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
|
false;
|
||||||
|
fi;
|
||||||
|
EOS
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "deactivate virtualenv (verbose)" {
|
||||||
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --verbose
|
||||||
|
|
||||||
|
assert_success
|
||||||
|
assert_output <<EOS
|
||||||
|
if declare -f deactivate 1>/dev/null 2>&1; then
|
||||||
|
echo "pyenv-virtualenv: deactivate venv" 1>&2;
|
||||||
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -25,13 +45,14 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (no-error)" {
|
@test "deactivate virtualenv (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
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
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
false;
|
false;
|
||||||
@@ -39,8 +60,9 @@ fi;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (w/o pyenv-virtualenv-init)" {
|
@test "deactivate virtualenv (without pyenv-virtualenv-init)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
||||||
|
|
||||||
@@ -48,7 +70,7 @@ EOS
|
|||||||
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;
|
pyenv shell --unset;
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -57,8 +79,9 @@ fi;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (w/o pyenv-virtualenv-init) (no-error)" {
|
@test "deactivate virtualenv (without pyenv-virtualenv-init) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
@@ -66,7 +89,7 @@ EOS
|
|||||||
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;
|
pyenv shell --unset;
|
||||||
export PYENV_DEACTIVATE="\$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
false;
|
false;
|
||||||
@@ -76,13 +99,14 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (fish)" {
|
@test "deactivate virtualenv (fish)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if functions -q deactivate
|
if functions -q deactivate
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -93,13 +117,14 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (fish) (no-error)" {
|
@test "deactivate virtualenv (fish) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if functions -q deactivate
|
if functions -q deactivate
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
false;
|
false;
|
||||||
@@ -107,8 +132,9 @@ end;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (fish) (w/o pyenv-virtualenv-init)" {
|
@test "deactivate virtualenv (fish) (without pyenv-virtualenv-init)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
||||||
|
|
||||||
@@ -116,7 +142,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if functions -q deactivate
|
if functions -q deactivate
|
||||||
pyenv shell --unset;
|
pyenv shell --unset;
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -125,8 +151,9 @@ end;
|
|||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "deactivate virtualenv (fish) (w/o pyenv-virtualenv-init) (no-error)" {
|
@test "deactivate virtualenv (fish) (without pyenv-virtualenv-init) (no-error)" {
|
||||||
export PYENV_VIRTUALENV_INIT=
|
export PYENV_VIRTUALENV_INIT=
|
||||||
|
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
@@ -134,7 +161,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
if functions -q deactivate
|
if functions -q deactivate
|
||||||
pyenv shell --unset;
|
pyenv shell --unset;
|
||||||
setenv PYENV_DEACTIVATE "\$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
false;
|
false;
|
||||||
|
|||||||
@@ -33,16 +33,16 @@ export PYENV_VIRTUALENV_INIT=1;
|
|||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
};
|
};
|
||||||
@@ -60,16 +60,16 @@ setenv PYENV_VIRTUALENV_INIT 1;
|
|||||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||||
if [ -n "\$VIRTUAL_ENV" ]
|
if [ -n "\$VIRTUAL_ENV" ]
|
||||||
if [ (pyenv version-name) = "system" ]
|
if [ (pyenv version-name) = "system" ]
|
||||||
eval (pyenv sh-deactivate); or true
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-deactivate); or true
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
eval (pyenv sh-activate 2>/dev/null); or true
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
if [ "\$PYENV_DEACTIVATE" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-activate 2>/dev/null); or true
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -84,16 +84,16 @@ export PYENV_VIRTUALENV_INIT=1;
|
|||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$VIRTUAL_ENV" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate || true
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_DEACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv activate 2>/dev/null || true
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user