From e5f1788d1caedfd992c2cd38c4eec47f8e7be23c Mon Sep 17 00:00:00 2001 From: Sebastian Wiesner Date: Fri, 13 Apr 2012 14:43:16 +0200 Subject: [PATCH] Only enable virtualenvwrapper, if WORKON_HOME is set Makes sure that virtualenvwrapper is only enabled for those that really intend to use it. --- modules/python/README.md | 6 +++--- modules/python/init.zsh | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/python/README.md b/modules/python/README.md index 2ef025eb..5a51c3a3 100644 --- a/modules/python/README.md +++ b/modules/python/README.md @@ -9,9 +9,9 @@ This module will prepend the per user site packages directory as defined in [PEP man pages installed into the per user site. It also sources the [_virtualenvwrapper_][2] initialization script, if -[_virtualenvwrapper_][2] is installed. [_virtualenvwrapper_][2] is a frontend -to [_virtualenv_][3] which provides convenient shell functions to create, switch -and manage virtualenvs. +[_virtualenvwrapper_][2] is installed and `$WORKON_HOME` is set. +[_virtualenvwrapper_][2] is a frontend to [_virtualenv_][3] which provides +convenient shell functions to create, switch and manage virtualenvs. Authors ------- diff --git a/modules/python/init.zsh b/modules/python/init.zsh index 17120174..64fde25c 100644 --- a/modules/python/init.zsh +++ b/modules/python/init.zsh @@ -21,6 +21,8 @@ else fi # source virtualenvwrapper if available -if (( $+commands[virtualenvwrapper.sh] )); then - source virtualenvwrapper.sh +if (( $+WORKON_HOME )); then + if (( $+commands[virtualenvwrapper.sh] )); then + source virtualenvwrapper.sh + fi fi