From edc3802d4aefbecf4b1d9c0e72786e562d5a7fd2 Mon Sep 17 00:00:00 2001 From: Dylan McCall Date: Tue, 26 Sep 2023 12:28:58 -0700 Subject: [PATCH] Add endless-key-kolibri-home to build output To enable this, we need to install `kolibri` in the build systme. It is used to generate a Kolibri home with content from a provided content manifest. Helps: https://github.com/endlessm/endless-key-content-private/issues/97 --- Makefile | 16 ++++++++++++++++ requirements.txt | 1 + src/kolibri_android/kolibri_utils.py | 3 +++ 3 files changed, 20 insertions(+) diff --git a/Makefile b/Makefile index 052331a0..44fc5d5f 100644 --- a/Makefile +++ b/Makefile @@ -57,6 +57,7 @@ CLEAN_DEPS = \ clean-kolibri \ clean-apps-bundle \ clean-collections \ + clean-endless-key-kolibri-home \ clean-local-kolibri-explore-plugin \ clean-loadingScreen CLEAN_FILES = \ @@ -145,6 +146,20 @@ clean-apps-bundle: src/apps-bundle: clean-apps-bundle apps-bundle.zip unzip -qo apps-bundle.zip -d src/apps-bundle +.PHONY: clean-endless-key-kolibri-home +clean-endless-key-kolibri-home: + - rm -rf src/kolibri/dist/home + +# This is phony because we are replacing existing files inside src/kolibri :( +.PHONY: src/kolibri/dist/home +src/kolibri/dist/home: src/collections src/kolibri + export KOLIBRI_HOME=src/kolibri/dist/home + rm -rf ${KOLIBRI_HOME} + kolibri manage migrate + cat src/collections/artist-0001.json | jq '.channels[] | .id' | xargs -n1 echo kolibri manage importchannel network + cat src/collections/artist-0001.json | jq '.channels[] | .id' | xargs -n1 echo kolibri manage importcontent --manifest=src/collections/artist-0001.json network + yes 'yes' | kolibri manage deprovision + .PHONY: collections.zip collections.zip: wget -N https://github.com/endlessm/endless-key-collections/releases/latest/download/collections.zip @@ -193,6 +208,7 @@ DIST_DEPS = \ src/kolibri \ src/apps-bundle \ src/collections \ + src/kolibri/dist/home \ assets/loadingScreen \ needs-version \ dist/version.json diff --git a/requirements.txt b/requirements.txt index 4ee5beb7..a1b86157 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ cython~=0.29 virtualenv git+https://github.com/endlessm/python-for-android@v2022.09.04-endless10#egg=python-for-android +kolibri diff --git a/src/kolibri_android/kolibri_utils.py b/src/kolibri_android/kolibri_utils.py index a704f837..4106b3b3 100644 --- a/src/kolibri_android/kolibri_utils.py +++ b/src/kolibri_android/kolibri_utils.py @@ -87,6 +87,9 @@ def _init_kolibri_env(): os.environ["KOLIBRI_CONTENT_COLLECTIONS_PATH"] = SCRIPT_PATH.joinpath( "collections" ).as_posix() + os.environ["KOLIBRI_CONTENT_FALLBACK_DIRS"] = SCRIPT_PATH.joinpath( + "kolibri", "dist", "home", "content" + ).as_posix() node_id = get_android_node_id()