From a7729561e8f9b2efee6177aca74809b7c8d7e63f Mon Sep 17 00:00:00 2001 From: Calvin Smith Date: Mon, 3 Apr 2017 23:06:02 -0700 Subject: [PATCH] Add support for skipping VIRTUALENVWRAPPER init in modules/python (#598) * Support skip-virtualenvwrapper-init zstyle in python module to avoid auto-sourcing of virtualenvwrapper.sh * Don't overwrite the WORKON_HOME env var if the user has already set it --- modules/python/init.zsh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/python/init.zsh b/modules/python/init.zsh index da78ea79..458253b2 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -34,10 +34,11 @@ if (( ! $+commands[python] && ! $+commands[pyenv] )); then return 1 fi -# Load virtualenvwrapper into the shell session. -if (( $+commands[virtualenvwrapper.sh] )); then +# Load virtualenvwrapper into the shell session, unless requested not to +zstyle -t ':prezto:module:python' skip-virtualenvwrapper-init +if (( $? && $+commands[virtualenvwrapper.sh] )); then # Set the directory where virtual environments are stored. - export WORKON_HOME="$HOME/.virtualenvs" + export WORKON_HOME="${WORKON_HOME:-$HOME/.virtualenvs}" # Disable the virtualenv prompt. VIRTUAL_ENV_DISABLE_PROMPT=1