diff --git a/Makefile b/Makefile index df3aa492e5e..b078c93ae26 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,12 @@ writeversion: @echo "Current version is now `cat kolibri/VERSION`" preseeddb: - PYTHONPATH=".:$PYTHONPATH" python build_tools/preseed_home.py + export KOLIBRI_HOME="$$(mktemp -d)"; \ + export PYTHONPATH=".:$$PYTHONPATH"; \ + cd kolibri; \ + python -m kolibri manage deprovision --destroy-all-user-data --permanent-irrevocable-data-loss; \ + mkdir -p dist/home; \ + cp $$KOLIBRI_HOME/*.sqlite3 dist/home/; setrequirements: rm -r requirements.txt || true # remove requirements.txt diff --git a/build_tools/preseed_home.py b/build_tools/preseed_home.py deleted file mode 100644 index d479ce4dfb0..00000000000 --- a/build_tools/preseed_home.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -import shutil -import tempfile - -temphome = tempfile.mkdtemp() -os.environ["KOLIBRI_HOME"] = temphome - -from kolibri.main import initialize # noqa E402 -from kolibri.deployment.default.sqlite_db_names import ( # noqa E402 - ADDITIONAL_SQLITE_DATABASES, -) -from django.conf import settings # noqa E402 -from django.core.management import call_command # noqa E402 - -move_to = os.path.join(os.path.dirname(__file__), "..", "kolibri", "dist", "home") -shutil.rmtree(move_to, ignore_errors=True) -os.mkdir(move_to) - -print("Generating preseeded home data in {}".format(temphome)) - -initialize() -call_command( - "deprovision", "--destroy-all-user-data", "--permanent-irrevocable-data-loss" -) - -for db_config in settings.DATABASES.values(): - if db_config["ENGINE"] == "django.db.backends.sqlite3": - shutil.move(os.path.join(temphome, db_config["NAME"]), move_to) - -print("Moved all preseeded home data to {}".format(move_to)) - -shutil.rmtree(temphome)