c0c9fc02543eb14de49b0416e3df1100845633d8
- Author
- Lei Zhang <zhang.lei.fly@gmail.com>
- Committer
- Lei Zhang <zhang.lei.fly@gmail.com>
- Date
Message
Add support .venv folder as virtual env
Diff
1diff --git a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
2index 670c287bd425d7b9616866d03f0832c1776d992e..16f32da6e170cd1ab98782c067d3c8c820227fe5 100644
3--- a/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
4+++ b/plugins/virtualenvwrapper/virtualenvwrapper.plugin.zsh
5@@ -17,6 +17,8 @@ if (( $+commands[$virtualenvwrapper] )); then
6 # Check for virtualenv name override
7 if [[ -f "$PROJECT_ROOT/.venv" ]]; then
8 ENV_NAME=`cat "$PROJECT_ROOT/.venv"`
9+ elif [[ -f "$PROJECT_ROOT/.venv/bin/activate" ]];then
10+ ENV_NAME="$PROJECT_ROOT/.venv"
11 elif [[ "$PROJECT_ROOT" != "." ]]; then
12 ENV_NAME=`basename "$PROJECT_ROOT"`
13 else
14@@ -27,6 +29,8 @@ if (( $+commands[$virtualenvwrapper] )); then
15 if [[ "$VIRTUAL_ENV" != "$WORKON_HOME/$ENV_NAME" ]]; then
16 if [[ -e "$WORKON_HOME/$ENV_NAME/bin/activate" ]]; then
17 workon "$ENV_NAME" && export CD_VIRTUAL_ENV="$ENV_NAME"
18+ elif [[ -e "$ENV_NAME/bin/activate" ]]; then
19+ source $ENV_NAME/bin/activate && export CD_VIRTUAL_ENV="$ENV_NAME"
20 fi
21 fi
22 elif [ $CD_VIRTUAL_ENV ]; then