Skip to content

Commit

Permalink
fix: prevent resetting VIRTUAL_ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Dec 10, 2024
1 parent b1ff8cd commit 46c5d79
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/exec-env
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ setup_virtualenv() {
fi

set +e
VIRTUAL_ENV="$(poetry_venv)"
venv="$(poetry_venv)"
poetry_venv_exit_code=$?
set -e

if [[ $poetry_venv_exit_code -eq 1 ]]; then
return
fi

if [[ ! -d "$VIRTUAL_ENV" ]]; then
if [[ ! -d "$venv" ]]; then
if [[ "${MISE_POETRY_AUTO_INSTALL:-}" != "true" ]] && [[ "${MISE_POETRY_AUTO_INSTALL:-}" != "1" ]]; then
return
fi
poetry_bin install
VIRTUAL_ENV="$(poetry_bin env info --path)"
venv="$(poetry_bin env info --path)"
fi

POETRY_ACTIVE=1
MISE_ADD_PATH="$VIRTUAL_ENV/bin"
export VIRTUAL_ENV POETRY_ACTIVE MISE_ADD_PATH
MISE_ADD_PATH="$venv/bin"
export VIRTUAL_ENV="$venv" POETRY_ACTIVE MISE_ADD_PATH
}

setup_virtualenv

0 comments on commit 46c5d79

Please sign in to comment.