From 25b699b44ea272e9bac7d75c7d86871e082122ae Mon Sep 17 00:00:00 2001 From: Anton Hvornum Date: Fri, 30 Apr 2021 15:33:26 +0200 Subject: Automatic loading of plugins --- archinstall/lib/plugins.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'archinstall/lib') diff --git a/archinstall/lib/plugins.py b/archinstall/lib/plugins.py index adf900b9..f744661a 100644 --- a/archinstall/lib/plugins.py +++ b/archinstall/lib/plugins.py @@ -1 +1,13 @@ -plugins = {} \ No newline at end of file +import pkgutil +import importlib +import imp # Deprecated + +plugins = {} + +for module_info in pkgutil.iter_modules(path=None, prefix=''): + if 'archinstall-' in module_info.name and module_info.ispkg: + try: + modulesource = importlib.import_module(module_info.name) + imp.reload(modulesource) + except Exception as e: + print('Could not load plugin {} {}'.format(modname, e)) \ No newline at end of file -- cgit v1.2.3-70-g09d2