mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-28 08:03:36 +00:00
setup: List dependencies for apps instead of modules
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
a0a6e1d362
commit
7eab8a2cda
@ -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:
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user