b85e1dd5d6b0ee527b313ce8c902bbc4e34e36e0

Author
Marc Cornellà <hello@mcornella.com>
Committer
Marc Cornellà <hello@mcornella.com>
Date

Message

fix(pyenv): fix for checking if pyenv-virtualenv is installed

Fixes #8467

Diff

 1diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
 2index 275c12c80ee81af4bf50cfbcfeb8b64d9ce7d3e2..bcf80a6a23219dc77e091b2c91e2470e53917c6d 100644
 3--- a/plugins/pyenv/pyenv.plugin.zsh
 4+++ b/plugins/pyenv/pyenv.plugin.zsh
 5@@ -46,16 +46,20 @@ For more info go to https://github.com/pyenv/pyenv/#installation.
 6 EOF
 7 
 8     # Configuring in .zshrc only makes pyenv available for interactive shells
 9-    export PYENV_ROOT=$dir
10+    export PYENV_ROOT="$dir"
11     export PATH="$PYENV_ROOT/bin:$PATH"
12     eval "$(pyenv init --path)"
13   fi
14 fi
15 
16 if [[ $FOUND_PYENV -eq 1 ]]; then
17+  if [[ -z "$PYENV_ROOT" ]]; then
18+    export PYENV_ROOT="$(pyenv root)"
19+  fi
20+
21   eval "$(pyenv init - --no-rehash zsh)"
22 
23-  if (( ${+commands[pyenv-virtualenv-init]} )); then
24+  if [[ -d "$PYENV_ROOT/plugins/pyenv-virtualenv" ]]; then
25     eval "$(pyenv virtualenv-init - zsh)"
26   fi
27