sangue/django/compila_apps.sh

22 lines
988 B
Bash

#!/bin/bash --
set -e
IFS=$'\n'
mkdir -p /django_static
find /django \( -iname '*.js' -and ! -path '*/vendor/*' \) -prune -exec bash -c 'set -x; mv "$1" "$1.orig.js" && javascript-obfuscator "$1.orig.js" -o "$1" && rm "$1.orig.js"' '' '{}' \;
env DEBUG_TOOLBAR=true poetry run python manage.py collectstatic --no-input
for DJANGO_APP in $(poetry run python manage.py shell < get_django_apps.py); do
echo -ne "Compilo app $DJANGO_APP..."
rm -rf "${DJANGO_APP}/migrations"
poetry run python -m nuitka --module "${DJANGO_APP}" --include-package="${DJANGO_APP}"
rm -rf "${DJANGO_APP}.build"
pushd "${DJANGO_APP}" || exit 1
find . -iname '*.py*' -delete;
popd
done
find . -iname '__pycache__' -prune -exec rm -rf '{}' \;
find . -iname '*.pyc' -delete
find . -iname 'compila_apps.sh' -delete
find . -iname 'sqldes2django.py' -delete
find . -iname 'modello_*.xml' -delete
#poetry cache:clear --all -n ..
#poetry install --no-dev && rm -rf /root/.cache/pypoetry/cache/