1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-07-01 15:10:28 +00:00

[python] Detect availability of virtualenv plugins as well as pyenv

Just having 'pyenv' available doesn't imply availability of virtualenv pyenv
plugins. Check for availability of virtualenv plugins as well before attempting
to use pyenv wrapper for virtualenv.
This commit is contained in:
Indrajit Raychaudhuri 2017-08-04 09:53:01 -05:00
parent a60499f933
commit 8d7e3e27c7

View File

@ -92,16 +92,16 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
# Disable the virtualenv prompt. # Disable the virtualenv prompt.
VIRTUAL_ENV_DISABLE_PROMPT=1 VIRTUAL_ENV_DISABLE_PROMPT=1
if (( $+commands[pyenv] )); then # Enable 'virtualenv' with 'pyenv'.
if (( $+commands[pyenv-virtualenv-init] )); then if (( $+commands[pyenv] && $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init -)" eval "$(pyenv virtualenv-init -)"
fi # Optionall activate 'virtualenvwrapper' with 'pyenv' is available.
if (( $#commands[(i)pyenv-virtualenvwrapper(_lazy|)] )); then if (( $#commands[(i)pyenv-virtualenvwrapper(_lazy|)] )); then
pyenv "${${(@O)commands[(I)pyenv-virtualenvwrapper(_lazy|)]}[1]#pyenv-}" pyenv "${${(@O)commands[(I)pyenv-virtualenvwrapper(_lazy|)]}[1]#pyenv-}"
fi fi
else else
# Try 'virtualenvwrapper' without 'pyenv' wrapper in '$path' and other # Fallback to 'virtualenvwrapper' without 'pyenv' wrapper in '$path'
# known locations on a Debian based system. # and other known locations on a Debian based system.
virtenv_sources=( virtenv_sources=(
${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]} ${(@Ov)commands[(I)virtualenvwrapper(_lazy|).sh]}
/usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN) /usr/share/virtualenvwrapper/virtualenvwrapper(_lazy|).sh(OnN)