From 7eab8a2cdab3c0072ae98e7dcb3d5603d2c5ded0 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 24 Nov 2021 12:00:04 -0800 Subject: [PATCH] setup: List dependencies for apps instead of modules Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/__main__.py | 8 ++++---- plinth/setup.py | 17 +++++++---------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/plinth/__main__.py b/plinth/__main__.py index 9ae18415a..e3a4ce8c4 100644 --- a/plinth/__main__.py +++ b/plinth/__main__.py @@ -55,12 +55,12 @@ def run_setup_and_exit(app_ids, allow_install=True): sys.exit(error_code) -def list_dependencies(module_list): - """List dependencies for all essential modules and exit.""" +def list_dependencies(app_ids): + """List dependencies for all essential apps and exit.""" error_code = 0 try: - if module_list: - setup.list_dependencies(module_list=module_list) + if app_ids: + setup.list_dependencies(app_ids=app_ids) else: setup.list_dependencies(essential=True) except Exception as exception: diff --git a/plinth/setup.py b/plinth/setup.py index 7860c57cd..1236b5cd9 100644 --- a/plinth/setup.py +++ b/plinth/setup.py @@ -3,7 +3,6 @@ Utilities for performing application setup operations. """ -import importlib import logging import sys import threading @@ -156,19 +155,17 @@ def setup_apps(app_ids=None, essential=False, allow_install=True): module.setup_helper.run(allow_install=allow_install) -def list_dependencies(module_list=None, essential=False): - """Print list of packages required by selected or essential modules.""" - for module_import_path in plinth.module_loader.get_modules_to_load(): - module_name = module_import_path.split('.')[-1] - module = importlib.import_module(module_import_path) - if essential and not module.app.info.is_essential: +def list_dependencies(app_ids=None, essential=False): + """Print list of packages required by selected or essential apps.""" + for app in app_module.App.list(): + if essential and not app.info.is_essential: continue - if module_list and module_name not in module_list and \ - '*' not in module_list: + if app_ids and app.app_id not in app_ids and \ + '*' not in app_ids: continue - for component in module.app.get_components_of_type(Packages): + for component in app.get_components_of_type(Packages): for package_name in component.packages: print(package_name)