From bc3a879ead8493a083b961b5ee007a739bd929fd Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 22 Nov 2021 05:38:10 -0800 Subject: [PATCH] first_boot: Drop use of loaded_modules and use App.list Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/first_boot/__init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/plinth/modules/first_boot/__init__.py b/plinth/modules/first_boot/__init__.py index 342516d91..2419dea62 100644 --- a/plinth/modules/first_boot/__init__.py +++ b/plinth/modules/first_boot/__init__.py @@ -5,10 +5,12 @@ FreedomBox app for first boot wizard. import operator import os +import sys from django.urls import reverse -from plinth import app, cfg, module_loader +from plinth import app as app_module +from plinth import cfg from plinth.signals import post_setup first_boot_steps = [ @@ -30,7 +32,7 @@ _all_first_boot_steps = None _is_completed = None -class FirstBootApp(app.App): +class FirstBootApp(app_module.App): """FreedomBox app for First Boot.""" app_id = 'first_boot' @@ -41,8 +43,8 @@ class FirstBootApp(app.App): """Create components for the app.""" super().__init__() - info = app.Info(app_id=self.app_id, version=self._version, - is_essential=True) + info = app_module.Info(app_id=self.app_id, version=self._version, + is_essential=True) self.add(info) def post_init(self): @@ -76,11 +78,11 @@ def _get_steps(): return _all_first_boot_steps steps = [] - modules = module_loader.loaded_modules - for module_object in modules.values(): - if getattr(module_object, 'first_boot_steps', None): - if not module_object.app.needs_setup(): - steps.extend(module_object.first_boot_steps) + for app in app_module.App.list(): + module = sys.modules[app.__module__] + if getattr(module, 'first_boot_steps', None): + if not app.needs_setup(): + steps.extend(module.first_boot_steps) _all_first_boot_steps = sorted(steps, key=operator.itemgetter('order')) return _all_first_boot_steps