Skip to content

Commit

Permalink
Load virtualenv with pyenv and not pyenv-virtualenv.
Browse files Browse the repository at this point in the history
Currently if one have pyenv but not pyenv-virtualenv the
virtualenvwrapper is never loaded. If no pyenv-virtualenvwrapper is
present, then try to load the default python virtualenvwrapper tool.

Fix sorin-ionescu#1413
  • Loading branch information
Diego Rabatone Oliveira committed Aug 4, 2017
1 parent 7b5196c commit eb15bc6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/python/init.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
# Disable the virtualenv prompt.
VIRTUAL_ENV_DISABLE_PROMPT=1

venv_set=0

if (( $+commands[pyenv] )); then
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init -)"
venv_set=1
fi
if (( $#commands[(i)pyenv-virtualenvwrapper(_lazy|)] )); then
pyenv "${${(@O)commands[(I)pyenv-virtualenvwrapper(_lazy|)]}[1]#pyenv-}"
venv_set=1
fi
else
fi
if (( !(${venv_set}) )); then
# Try 'virtualenvwrapper' without 'pyenv' wrapper in '$path' and other
# known locations on a Debian based system.
virtenv_sources=(
Expand All @@ -109,6 +114,7 @@ if (( $+VIRTUALENVWRAPPER_VIRTUALENV || $+commands[virtualenv] )) && \
source "${virtenv_sources[1]}"
unset virtenv_sources
fi
unset venv_set
fi

# Load PIP completion.
Expand Down

0 comments on commit eb15bc6

Please sign in to comment.