From 9f63f4d6dfffb5d28ee50d4fe183395ee69fe30e Mon Sep 17 00:00:00 2001 From: Alex Zenla Date: Mon, 18 Nov 2024 11:28:20 -0500 Subject: [PATCH] add hack/build/activate-env.sh to simplify dev environment --- hack/build/activate-env.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 hack/build/activate-env.sh diff --git a/hack/build/activate-env.sh b/hack/build/activate-env.sh new file mode 100755 index 0000000..0eb8c04 --- /dev/null +++ b/hack/build/activate-env.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +PREVIOUS_CWD="${PWD}" +REAL_SCRIPT="$(realpath "${0}")" +cd "$(dirname "${REAL_SCRIPT}")/../.." || return +unset REAL_SCRIPT + +activate_env() { + if [ ! -d "venv" ]; then + python3 -m venv venv + pip install --upgrade pip + fi + . venv/bin/activate + pip3 install -qq -r requirements.txt +} + +activate_env +unset -f activate_env +cd "${PREVIOUS_CWD}" || return +unset PREVIOUS_CWD