Skip to content

Commit 5d09a90

Browse files
sk1234567891Shmuel Israelovpre-commit-ci[bot]
authored
fix: wrong path on migrated venv (#2996)
Co-authored-by: Shmuel Israelov <sam.israelov@mobileye.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 23032cb commit 5d09a90

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/virtualenv/activation/bash/activate.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ deactivate () {
5656
# unset irrelevant variables
5757
deactivate nondestructive
5858

59-
VIRTUAL_ENV=__VIRTUAL_ENV__
59+
if [ ! -d __VIRTUAL_ENV__ ]; then
60+
echo "Virtual environment directory __VIRTUAL_ENV__ does not exist!" >&2
61+
CURRENT_PATH=$(realpath "${0}")
62+
CURRENT_DIR=$(dirname "${CURRENT_PATH}")
63+
VIRTUAL_ENV="$(realpath "${CURRENT_DIR}/../")"
64+
else
65+
VIRTUAL_ENV=__VIRTUAL_ENV__
66+
fi
67+
6068
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
6169
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
6270
fi

0 commit comments

Comments
 (0)