From 1050a0a290324f3b96256d3b1fefe4a84ab402d0 Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Tue, 18 Apr 2017 03:14:22 -0700 Subject: [PATCH] Add better support for pyenv virtualenvs --- modules/python/init.zsh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 8b63251..e40bca6 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -35,15 +35,20 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then fi # Load virtualenvwrapper into the shell session, unless requested not to -zstyle -t ':prezto:module:python' skip-virtualenvwrapper-init -if (( $? && $+commands[virtualenvwrapper.sh] )); then +if zstyle -T ':prezto:module:python' skip-virtualenvwrapper-init; then # Set the directory where virtual environments are stored. export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" # Disable the virtualenv prompt. VIRTUAL_ENV_DISABLE_PROMPT=1 - source "$commands[virtualenvwrapper.sh]" + if (( $+commands[pyenv-virtualenvwrapper] )); then + pyenv virtualenvwrapper + elif (( $+commands[pyenv-virtualenv-init] )); then + eval "$(pyenv virtualenv-init -)" + elif (( $+commands[virtualenvwrapper.sh] )); then + source "$commands[virtualenvwrapper.sh]" + fi fi # Load PIP completion.