summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormar77i <mar77i@protonmail.ch>2020-01-25 02:29:10 +0100
committermar77i <mar77i@protonmail.ch>2020-01-25 02:29:10 +0100
commite5fda3abe351db847952d4a80b4aa217725cbf46 (patch)
treea040a41644be1cd8fbd042484bc31074d87bc1b8
parentbc7e816fefa48f6b94181ceb1a8fd4943853bb1f (diff)
make setup_venv universal wrt env.sh
-rwxr-xr-xmanage.sh22
1 files changed, 13 insertions, 9 deletions
diff --git a/manage.sh b/manage.sh
index 9cca077..ea2f99c 100755
--- a/manage.sh
+++ b/manage.sh
@@ -29,21 +29,25 @@ setup_venv() {
else
VIRTUAL_ENV="${venvs[0]}"
fi
+ if [[ ! -e env.sh && -x ./envsetup.sh ]]; then
+ echo "Warning: env.sh is missing and needs to be configured." >&2
+ ./envsetup.sh
+ fi
if [[ ! -d "${VIRTUAL_ENV}" ]]; then
python -m venv "${VIRTUAL_ENV}"
- d='${VIRTUAL_ENV}'
- d="[[ -n \"${d}\" && -r \"${d}/../env.sh\" ]] &&"
- d="${d} . \"${d}/../env.sh\" --deactivate"
- sed -i -r $'/unset VIRTUAL_ENV/i\\ '"${d}" \
- "${VIRTUAL_ENV}/bin/activate"
+ if [[ -e env.sh ]]; then
+ d='${VIRTUAL_ENV}'
+ d="[[ -n \"${d}\" && -r \"${d}/../env.sh\" ]] &&"
+ d="${d} . \"${d}/../env.sh\" --deactivate"
+ sed -i -r $'/unset VIRTUAL_ENV/i\\ '"${d}" \
+ "${VIRTUAL_ENV}/bin/activate"
+ fi
fi
. "${VIRTUAL_ENV}/bin/activate"
pip install -qU pip -r requirements.txt
- if [[ ! -e env.sh && -x ./envsetup.sh ]]; then
- echo "Warning: env.sh is missing and needs to be configured." >&2
- ./envsetup.sh
+ if [[ -e env.sh ]]; then
+ . env.sh
fi
- . env.sh
return 0
}