Skip to content

Commit

Permalink
Update functions.sh: only run deactivate if activate was already run
Browse files Browse the repository at this point in the history
  • Loading branch information
EricClaeys authored Dec 12, 2023
1 parent ce8fd6f commit 37a8c15
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -822,15 +822,17 @@ function indent()
}

# Python virtual environment
PYTHON_VENV_ACTIVATED="false"
activate_python_venv() {
if [[ ${PI_OS} == "bookworm" ]]; then
#shellcheck disable=SC1090,SC1091
source "${ALLSKY_PYTHON_VENV}/bin/activate" || exit 1
PYTHON_VENV_ACTIVATED="true"
return 0 # Successfully activated
fi
return 1
}

deactivate_python_venv() {
[[ ${PI_OS} == "bookworm" ]] && deactivate
[[ ${PYTHON_VENV_ACTIVATED} == "true" ]] && deactivate
}

0 comments on commit 37a8c15

Please sign in to comment.