From 3023edbfe3311b3d2809573c93c3d88f69431078 Mon Sep 17 00:00:00 2001 From: Maks Snegov Date: Sun, 22 Dec 2024 14:49:42 -0800 Subject: [PATCH] update-python-env: fix empty .python-version situation Even if .python-version is empty, virtualenv with desired name could be created somewhere in the system. So we need to delete it in any case. If there is no such virtualenv, we are ignoring errors. --- update-python-env.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/update-python-env.sh b/update-python-env.sh index b1285bd..0a820d3 100755 --- a/update-python-env.sh +++ b/update-python-env.sh @@ -23,13 +23,11 @@ if [ $res -eq 1 ]; then fi CUR_VENV=$(cat .python-version) -if [ -n "$CUR_VENV" ]; then - echo "[*] Removing current virtualenv ($CUR_VENV)" - pyenv virtualenv-delete -f $CUR_VENV || exit 1 +echo "[*] Removing current virtualenv ($CUR_VENV)" +pyenv virtualenv-delete -f $CUR_VENV || true - echo "[*] Removing virtualenv named as project ($PROJECT)" - pyenv virtualenv-delete -f $PROJECT || exit 1 -fi +echo "[*] Removing virtualenv named as project ($PROJECT)" +pyenv virtualenv-delete -f $PROJECT || true NEW_VENV=$PY_VER/envs/$PROJECT echo "[*] Creating new virtualenv ($NEW_VENV)"