Browse Source

Simplify build config setup. Allow overwrite rather than requiring

default plugins to be populated.
pull/7035/head
Richard Tibbles 1 year ago
parent
commit
526f773a16
  1. 2
      .gitignore
  2. 7
      build_tools/customize_build.py
  3. 13
      build_tools/default_plugins.txt
  4. 17
      kolibri/__init__.py
  5. 13
      kolibri/plugins/__init__.py
  6. 15
      kolibri/utils/build_config/default_plugins.py
  7. 1
      kolibri/utils/build_config/default_settings.py
  8. 5
      kolibri/utils/env.py

2
.gitignore

@ -28,8 +28,6 @@ lib
lib64
pip
# Build configurations
kolibri/utils/build_config
# This can be dynamically changed at build time, and it should never change otherwise
requirements.txt

7
build_tools/customize_build.py

@ -13,11 +13,6 @@ import requests
sys.path.append(os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
os.environ.setdefault(
"RUN_TIME_PLUGINS",
os.path.realpath(os.path.join(os.path.dirname(__file__), "default_plugins.txt")),
)
plugins_cache = {}
@ -66,7 +61,7 @@ def set_default_settings_module():
f.write(default_settings_template.format(path=default_settings_path))
run_time_plugin_template = "plugins = {plugins}\n"
run_time_plugin_template = "DEFAULT_PLUGINS = {plugins}\n"
def set_run_time_plugins():

13
build_tools/default_plugins.txt

@ -1,13 +0,0 @@
kolibri.plugins.facility
kolibri.plugins.device
kolibri.plugins.learn
kolibri.plugins.pdf_viewer
kolibri.plugins.html5_viewer
kolibri.plugins.media_player
kolibri.plugins.setup_wizard
kolibri.plugins.coach
kolibri.plugins.user
kolibri_exercise_perseus_plugin
kolibri.plugins.epub_viewer
kolibri.plugins.default_theme
kolibri.plugins.slideshow_viewer

17
kolibri/__init__.py

@ -26,18 +26,19 @@ __version__ = str(get_version(VERSION))
#: Define it here to avoid introspection malarkey, and to allow for
#: import in setup.py for creating a list of plugin entry points.
INTERNAL_PLUGINS = [
"kolibri.plugins.facility",
"kolibri.plugins.app",
"kolibri.plugins.coach",
"kolibri.plugins.default_theme",
"kolibri.plugins.demo_server",
"kolibri.plugins.device",
"kolibri.plugins.learn",
"kolibri.plugins.pdf_viewer",
"kolibri.plugins.epub_viewer",
"kolibri.plugins.h5p_viewer",
"kolibri.plugins.html5_viewer",
"kolibri.plugins.facility",
"kolibri.plugins.learn",
"kolibri.plugins.media_player",
"kolibri.plugins.pdf_viewer",
"kolibri.plugins.setup_wizard",
"kolibri.plugins.coach",
"kolibri.plugins.user",
"kolibri.plugins.epub_viewer",
"kolibri.plugins.default_theme",
"kolibri.plugins.slideshow_viewer",
"kolibri.plugins.app",
"kolibri.plugins.user",
]

13
kolibri/plugins/__init__.py

@ -12,23 +12,12 @@ from importlib import import_module
from django.utils.module_loading import module_has_submodule
from six import with_metaclass
from kolibri import INTERNAL_PLUGINS
from kolibri.utils.build_config.default_plugins import DEFAULT_PLUGINS
from kolibri.utils.conf import KOLIBRI_HOME
logger = logging.getLogger(__name__)
try:
# The default list for this is populated from build_tools/default_plugins.txt
# in the root of the Kolibri repository. It may also have been set at build time
# to specify a different list of plugins
from kolibri.utils.build_config.default_plugins import plugins
DEFAULT_PLUGINS = plugins
except ImportError:
DEFAULT_PLUGINS = INTERNAL_PLUGINS + ["kolibri_exercise_perseus_plugin"]
conf_file = os.path.join(KOLIBRI_HOME, "plugins.json")

15
kolibri/utils/build_config/default_plugins.py

@ -0,0 +1,15 @@
DEFAULT_PLUGINS = [
"kolibri.plugins.coach",
"kolibri.plugins.default_theme",
"kolibri.plugins.device",
"kolibri.plugins.epub_viewer",
"kolibri.plugins.html5_viewer",
"kolibri.plugins.facility",
"kolibri.plugins.learn",
"kolibri.plugins.media_player",
"kolibri.plugins.pdf_viewer",
"kolibri.plugins.setup_wizard",
"kolibri.plugins.slideshow_viewer",
"kolibri.plugins.user",
"kolibri_exercise_perseus_plugin",
]

1
kolibri/utils/build_config/default_settings.py

@ -0,0 +1 @@
settings_path = "kolibri.deployment.default.settings.base"

5
kolibri/utils/env.py

@ -77,10 +77,7 @@ def set_env():
)
]
try:
from .build_config.default_settings import settings_path
except ImportError:
settings_path = "kolibri.deployment.default.settings.base"
from .build_config.default_settings import settings_path
# Set default env
os.environ.setdefault("DJANGO_SETTINGS_MODULE", settings_path)

Loading…
Cancel
Save