mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-10 04:23:53 -05:00
Fix issues with manual activation of virtual environments (#34)
This commit is contained in:
@@ -99,17 +99,20 @@ if [ -z "$no_shell" ]; then
|
|||||||
echo "pyenv shell \"${versions}\";"
|
echo "pyenv shell \"${versions}\";"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
prefix="$(pyenv-prefix "${versions}")"
|
||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
set -e PYENV_DEACTIVATE;
|
set -e PYENV_DEACTIVATE;
|
||||||
. "$(pyenv-prefix "${versions}")/bin/activate.fish";
|
setenv PYENV_ACTIVATE "${prefix}";
|
||||||
|
. "${prefix}/bin/activate.fish";
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
source "$(pyenv-prefix "${versions}")/bin/activate";
|
export PYENV_ACTIVATE="${prefix}";
|
||||||
|
source "${prefix}/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ fish )
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -n "$VERBOSE" ]; then
|
if [ -n "$VERBOSE" ]; then
|
||||||
echo " echo \"pyenv-virtualenv: deactivate ${VIRTUAL_ENV##*/}\" 1>&2;"
|
echo " echo \"pyenv-virtualenv: deactivate ${PYENV_ACTIVATE##*/}\" 1>&2;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
if [ -z "${PYENV_VIRTUALENV_INIT}" ]; then
|
||||||
@@ -50,14 +50,16 @@ fi
|
|||||||
case "$shell" in
|
case "$shell" in
|
||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
setenv PYENV_DEACTIVATE "$VIRTUAL_ENV";
|
setenv PYENV_DEACTIVATE "$PYENV_ACTIVATE";
|
||||||
|
set -e PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
EOS
|
EOS
|
||||||
;;
|
;;
|
||||||
* )
|
* )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
EOS
|
EOS
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ case "$shell" in
|
|||||||
fish )
|
fish )
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
function _pyenv_virtualenv_hook --on-event fish_prompt;
|
||||||
if [ -n "\$VIRTUAL_ENV" ]
|
if [ -n "\$PYENV_ACTIVATE" ]
|
||||||
if [ (pyenv version-name) = "system" ]
|
if [ (pyenv version-name) = "system" ]
|
||||||
eval (pyenv sh-deactivate --no-error --verbose)
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-deactivate --no-error --verbose)
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
eval (pyenv sh-activate --no-error --verbose)
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
@@ -106,12 +106,12 @@ esac
|
|||||||
|
|
||||||
if [[ "$shell" != "fish" ]]; then
|
if [[ "$shell" != "fish" ]]; then
|
||||||
cat <<EOS
|
cat <<EOS
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$PYENV_ACTIVATE" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_ACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ setup() {
|
|||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv";
|
||||||
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -44,6 +45,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
pyenv-virtualenv: activate venv
|
pyenv-virtualenv: activate venv
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv";
|
||||||
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -65,6 +67,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
pyenv shell "venv";
|
pyenv shell "venv";
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv";
|
||||||
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
source "${PYENV_ROOT}/versions/venv/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -85,6 +88,7 @@ EOS
|
|||||||
assert_success
|
assert_success
|
||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
set -e PYENV_DEACTIVATE;
|
set -e PYENV_DEACTIVATE;
|
||||||
|
setenv PYENV_ACTIVATE "${PYENV_ROOT}/versions/venv";
|
||||||
. "${PYENV_ROOT}/versions/venv/bin/activate.fish";
|
. "${PYENV_ROOT}/versions/venv/bin/activate.fish";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -106,6 +110,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
pyenv shell "venv";
|
pyenv shell "venv";
|
||||||
set -e PYENV_DEACTIVATE;
|
set -e PYENV_DEACTIVATE;
|
||||||
|
setenv PYENV_ACTIVATE "${PYENV_ROOT}/versions/venv";
|
||||||
. "${PYENV_ROOT}/versions/venv/bin/activate.fish";
|
. "${PYENV_ROOT}/versions/venv/bin/activate.fish";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -125,6 +130,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
pyenv shell "venv27";
|
pyenv shell "venv27";
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv27";
|
||||||
source "${PYENV_ROOT}/versions/venv27/bin/activate";
|
source "${PYENV_ROOT}/versions/venv27/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
@@ -144,6 +150,7 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
pyenv shell "venv27";
|
pyenv shell "venv27";
|
||||||
unset PYENV_DEACTIVATE;
|
unset PYENV_DEACTIVATE;
|
||||||
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv27";
|
||||||
source "${PYENV_ROOT}/versions/venv27/bin/activate";
|
source "${PYENV_ROOT}/versions/venv27/bin/activate";
|
||||||
EOS
|
EOS
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,15 @@ setup() {
|
|||||||
|
|
||||||
@test "deactivate virtualenv" {
|
@test "deactivate virtualenv" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
export PYENV_ACTIVATE="${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="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -26,7 +27,7 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (verbose)" {
|
@test "deactivate virtualenv (verbose)" {
|
||||||
export PYENV_VIRTUALENV_INIT=1
|
export PYENV_VIRTUALENV_INIT=1
|
||||||
export VIRTUAL_ENV="${PYENV_ROOT}/versions/venv"
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --verbose
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --verbose
|
||||||
|
|
||||||
@@ -34,7 +35,8 @@ 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
|
||||||
echo "pyenv-virtualenv: deactivate venv" 1>&2;
|
echo "pyenv-virtualenv: deactivate venv" 1>&2;
|
||||||
export PYENV_DEACTIVATE="$VIRTUAL_ENV";
|
export PYENV_DEACTIVATE="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -45,14 +47,15 @@ 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"
|
export PYENV_ACTIVATE="${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="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
false;
|
false;
|
||||||
@@ -62,7 +65,7 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (without 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"
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
PYENV_SHELL="bash" run pyenv-sh-deactivate
|
||||||
|
|
||||||
@@ -70,7 +73,8 @@ 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="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -81,7 +85,7 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (without 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"
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="bash" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
@@ -89,7 +93,8 @@ 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="$PYENV_ACTIVATE";
|
||||||
|
unset PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else
|
else
|
||||||
false;
|
false;
|
||||||
@@ -99,14 +104,15 @@ 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"
|
export PYENV_ACTIVATE="${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 "$PYENV_ACTIVATE";
|
||||||
|
set -e PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -117,14 +123,15 @@ 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"
|
export PYENV_ACTIVATE="${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 "$PYENV_ACTIVATE";
|
||||||
|
set -e PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
false;
|
false;
|
||||||
@@ -134,7 +141,7 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (fish) (without 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"
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
PYENV_SHELL="fish" run pyenv-sh-deactivate
|
||||||
|
|
||||||
@@ -142,7 +149,8 @@ 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 "$PYENV_ACTIVATE";
|
||||||
|
set -e PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
echo "pyenv-virtualenv: no virtualenv has been activated." 1>&2;
|
||||||
@@ -153,7 +161,7 @@ EOS
|
|||||||
|
|
||||||
@test "deactivate virtualenv (fish) (without 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"
|
export PYENV_ACTIVATE="${PYENV_ROOT}/versions/venv"
|
||||||
|
|
||||||
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
PYENV_SHELL="fish" run pyenv-sh-deactivate --no-error
|
||||||
|
|
||||||
@@ -161,7 +169,8 @@ 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 "$PYENV_ACTIVATE";
|
||||||
|
set -e PYENV_ACTIVATE;
|
||||||
deactivate;
|
deactivate;
|
||||||
else;
|
else;
|
||||||
false;
|
false;
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ load test_helper
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
export PYENV_VIRTUALENV_INIT=1;
|
export PYENV_VIRTUALENV_INIT=1;
|
||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$PYENV_ACTIVATE" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_ACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
@@ -58,12 +58,12 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
setenv PYENV_VIRTUALENV_INIT 1;
|
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 "\$PYENV_ACTIVATE" ]
|
||||||
if [ (pyenv version-name) = "system" ]
|
if [ (pyenv version-name) = "system" ]
|
||||||
eval (pyenv sh-deactivate --no-error --verbose)
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
if [ "\$VIRTUAL_ENV" != (pyenv prefix) ]
|
if [ "\$PYENV_ACTIVATE" != (pyenv prefix) ]
|
||||||
eval (pyenv sh-deactivate --no-error --verbose)
|
eval (pyenv sh-deactivate --no-error --verbose)
|
||||||
eval (pyenv sh-activate --no-error --verbose)
|
eval (pyenv sh-activate --no-error --verbose)
|
||||||
end
|
end
|
||||||
@@ -82,12 +82,12 @@ EOS
|
|||||||
assert_output <<EOS
|
assert_output <<EOS
|
||||||
export PYENV_VIRTUALENV_INIT=1;
|
export PYENV_VIRTUALENV_INIT=1;
|
||||||
_pyenv_virtualenv_hook() {
|
_pyenv_virtualenv_hook() {
|
||||||
if [ -n "\$VIRTUAL_ENV" ]; then
|
if [ -n "\$PYENV_ACTIVATE" ]; then
|
||||||
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
if [ "x\`pyenv version-name\`" = "xsystem" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
if [ "x\$VIRTUAL_ENV" != "x\`pyenv prefix\`" ]; then
|
if [ "x\$PYENV_ACTIVATE" != "x\`pyenv prefix\`" ]; then
|
||||||
pyenv deactivate --no-error --verbose
|
pyenv deactivate --no-error --verbose
|
||||||
pyenv activate --no-error --verbose
|
pyenv activate --no-error --verbose
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user