1
0
Fork 0

don't pollute env vars in virtenv plugin

This commit is contained in:
Luca Bilke 2024-02-22 16:10:46 +01:00
parent 31c6be45ce
commit 1eba4db0c7
1 changed files with 4 additions and 4 deletions

View File

@ -6,14 +6,14 @@ type workon >/dev/null 2>&1
} }
workon_cwd() { workon_cwd() {
PROJECT_ROOT="${PWD}" local PROJECT_ROOT="${PWD}"
while [ "$PROJECT_ROOT" != "/" ] && [ ! -e "$PROJECT_ROOT/.venv" ] && [ ! -d "$PROJECT_ROOT/.git" ]; do while [ "$PROJECT_ROOT" != "/" ] && [ ! -e "$PROJECT_ROOT/.venv" ] && [ ! -d "$PROJECT_ROOT/.git" ]; do
PROJECT_ROOT="$(dirname "$PROJECT_ROOT")" local PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
done done
if [ -r "$PROJECT_ROOT/.venv" ]; then if [ -r "$PROJECT_ROOT/.venv" ]; then
ENV_NAME="$(cat $PROJECT_ROOT/.venv)" local ENV_NAME="$(cat $PROJECT_ROOT/.venv)"
# else # else
# ENV_NAME="$(basename "$PROJECT_ROOT")" # ENV_NAME="$(basename "$PROJECT_ROOT")"
fi fi
@ -29,7 +29,7 @@ workon_cwd() {
elif [ -e "$ENV_NAME/bin/activate" ]; then elif [ -e "$ENV_NAME/bin/activate" ]; then
source "$ENV_NAME/bin/activate" && export CD_VIRTUAL_ENV="$ENV_NAME" source "$ENV_NAME/bin/activate" && export CD_VIRTUAL_ENV="$ENV_NAME"
else else
ENV_NAME="" local ENV_NAME=""
fi fi
} }