From d468108188c40be69e71e84d0eeeabf894ce5517 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Mon, 21 Nov 2022 21:59:38 +0100 Subject: [PATCH] ensure_web_installed --- make/lib.sh | 7 +++++++ make/run | 2 +- make/schema | 2 +- make/sync_prod_flatpages | 2 +- make/test | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/make/lib.sh b/make/lib.sh index 195b6647..a02b94e2 100644 --- a/make/lib.sh +++ b/make/lib.sh @@ -33,6 +33,13 @@ function ensure_venv { python -c 'print()' > /dev/null || die "Python ve venvu je rozbitý. Prosím smaž venv a zkus to znovu." } +function ensure_web_installed { + ensure_venv + python -c 'import django; print(django.__version__)' > /dev/null && return + echo >&2 "POZOR: Web nevypadá nainstalovaně, instaluji." + make/install_web +} + function gimli_only { # Rovnou zkontrolujeme i uživatele if test "$HOSTNAME" != gimli -o "$USER" != mam-web diff --git a/make/run b/make/run index c601593a..c3caf58d 100755 --- a/make/run +++ b/make/run @@ -3,6 +3,6 @@ set -exuo pipefail . make/lib.sh -ensure_venv +ensure_web_installed ./manage.py runserver "$@" diff --git a/make/schema b/make/schema index 9688e49a..05e84b61 100755 --- a/make/schema +++ b/make/schema @@ -3,7 +3,7 @@ set -exuo pipefail . make/lib.sh -ensure_venv +ensure_web_installed ./manage.py graph_models seminar | dot -Tpdf > schema_seminar.pdf ./manage.py graph_models -a -g | dot -Tpdf > schema_all.pdf diff --git a/make/sync_prod_flatpages b/make/sync_prod_flatpages index 4d9d8e1f..ca32c95b 100755 --- a/make/sync_prod_flatpages +++ b/make/sync_prod_flatpages @@ -3,7 +3,7 @@ set -exuo pipefail . make/lib.sh -ensure_venv +ensure_web_installed # TODO: This is very ugly, will fix in a future PR (hopefully) ssh "$GIMLI_LOGIN" " diff --git a/make/test b/make/test index ff5175c9..155d03fa 100755 --- a/make/test +++ b/make/test @@ -3,7 +3,7 @@ set -exuo pipefail . make/lib.sh -ensure_venv +ensure_web_installed trap - ERR # Testy nejspíš selžou, ale nechceme kolem toho dělat další chybovou hlášku. ./manage.py test -v2