From e642856e180fdfca2bf76ccc7f7545aad9f8196d Mon Sep 17 00:00:00 2001 From: "Neil John D. Ortega" Date: Wed, 25 Dec 2013 21:40:29 +0800 Subject: [PATCH] Allow subdirectories to have their own .venv setting --- plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh index 16f32da6e..5a03d16bc 100644 --- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh +++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh @@ -15,9 +15,11 @@ if (( $+commands[$virtualenvwrapper] )); then PROJECT_ROOT="." fi # Check for virtualenv name override - if [[ -f "$PROJECT_ROOT/.venv" ]]; then + if [[ -f "$PWD/.venv" && $PWD = $PROJECT_ROOT/* ]]; then + ENV_NAME=`cat "$PWD/.venv"` + elif [[ -f "$PROJECT_ROOT/.venv" ]]; then ENV_NAME=`cat "$PROJECT_ROOT/.venv"` - elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then + elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]]; then ENV_NAME="$PROJECT_ROOT/.venv" elif [[ "$PROJECT_ROOT" != "." ]]; then ENV_NAME=`basename "$PROJECT_ROOT"`