don't pollute env vars in virtenv plugin
This commit is contained in:
parent
31c6be45ce
commit
1eba4db0c7
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue