From 7e8223eac14241bc0156fe8d983460edf537f412 Mon Sep 17 00:00:00 2001 From: Yamashita Yuu Date: Fri, 4 Jul 2014 15:44:55 +0900 Subject: [PATCH] Fix issues with manual activation of virtual environments (#34) --- bin/pyenv-sh-activate | 6 ++++-- bin/pyenv-sh-deactivate | 6 ++++-- bin/pyenv-virtualenv-init | 8 ++++---- test/activate.bats | 18 ++++++++++++------ test/deactivate.bats | 12 ++++++++---- test/init.bats | 12 ++++++------ 6 files changed, 38 insertions(+), 24 deletions(-) diff --git a/bin/pyenv-sh-activate b/bin/pyenv-sh-activate index eaa6b75..ff8967e 100755 --- a/bin/pyenv-sh-activate +++ b/bin/pyenv-sh-activate @@ -78,13 +78,15 @@ case "$shell" in fish ) cat </dev/null 2>&1; then - export PYENV_DEACTIVATE="\$VIRTUAL_ENV"; + export PYENV_DEACTIVATE="\$PYENV_ACTIVATE"; + unset PYENV_ACTIVATE; deactivate; fi; EOS diff --git a/bin/pyenv-virtualenv-init b/bin/pyenv-virtualenv-init index 8e0b11c..943bcec 100755 --- a/bin/pyenv-virtualenv-init +++ b/bin/pyenv-virtualenv-init @@ -75,12 +75,12 @@ case "$shell" in fish ) cat </dev/null); or true end @@ -106,12 +106,12 @@ esac if [[ "$shell" != "fish" ]]; then cat </dev/null || true fi diff --git a/test/activate.bats b/test/activate.bats index a6a65d0..15b4056 100644 --- a/test/activate.bats +++ b/test/activate.bats @@ -23,7 +23,8 @@ setup() { assert_success assert_output </dev/null 2>&1; then - export PYENV_DEACTIVATE="\$VIRTUAL_ENV"; + export PYENV_DEACTIVATE="\$PYENV_ACTIVATE"; + unset PYENV_ACTIVATE; deactivate; fi; EOS @@ -28,7 +29,8 @@ EOS assert_success assert_output </dev/null 2>&1; then - export PYENV_DEACTIVATE="\$VIRTUAL_ENV"; + export PYENV_DEACTIVATE="\$PYENV_ACTIVATE"; + unset PYENV_ACTIVATE; deactivate; fi; pyenv shell --unset; @@ -43,7 +45,8 @@ EOS assert_success assert_output </dev/null || true fi @@ -58,12 +58,12 @@ EOS assert_output </dev/null); or true end @@ -82,12 +82,12 @@ EOS assert_output </dev/null || true fi