2 Commits

Author SHA1 Message Date
k
a54ddef566 Merge 5d7894d189 into e8c8fd9b84 2024-12-11 22:14:30 -08:00
K Kollmann
5d7894d189 fix: PATH update for non-fish shells
Checks PATH variable for existing inclusion of shims
for shells other than fish.

See PR #430
2024-01-20 20:10:27 +01:00
2 changed files with 12 additions and 6 deletions

View File

@@ -95,8 +95,10 @@ EOS
;;
* )
cat <<EOS
export PATH="${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
if [[ ":$PATH:" != *"${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims"* ]]; then
export PATH="${PYENV_VIRTUALENV_ROOT:-${PYENV_VIRTUALENV_INSTALL_PREFIX}}/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
fi
EOS
;;
esac

View File

@@ -50,8 +50,10 @@ load test_helper
run pyenv-virtualenv-init - bash
assert_success
assert_output <<EOS
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
if [[ ":$PATH:" != *"${TMP}/pyenv/plugins/pyenv-virtualenv/shims"* ]]; then
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
fi
_pyenv_virtualenv_hook() {
local ret=\$?
if [ -n "\${VIRTUAL_ENV-}" ]; then
@@ -93,8 +95,10 @@ EOS
run pyenv-virtualenv-init - zsh
assert_success
assert_output <<EOS
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
if [[ ":$PATH:" != *"${TMP}/pyenv/plugins/pyenv-virtualenv/shims"* ]]; then
export PATH="${TMP}/pyenv/plugins/pyenv-virtualenv/shims:\${PATH}";
export PYENV_VIRTUALENV_INIT=1;
fi
_pyenv_virtualenv_hook() {
local ret=\$?
if [ -n "\${VIRTUAL_ENV-}" ]; then