mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 17:23:36 +02:00
cmds/__init__.py: Make class loading dynamic
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
58142a1115
commit
a6bf4b164a
1 changed files with 13 additions and 4 deletions
|
|
@ -1,4 +1,13 @@
|
||||||
from .CmdProjects import CmdProjects
|
import importlib, pkgutil
|
||||||
from .CmdDistro import CmdDistro
|
|
||||||
from .CmdSecrets import CmdSecrets
|
__all__ = []
|
||||||
from .CmdDistro import CmdDistro
|
|
||||||
|
for finder, module_name, ispkg in pkgutil.iter_modules(__path__):
|
||||||
|
if not module_name.startswith("Cmd"):
|
||||||
|
continue
|
||||||
|
if module_name == "Cmd":
|
||||||
|
continue
|
||||||
|
module = importlib.import_module(f".{module_name}", __name__)
|
||||||
|
cls = getattr(module, module_name)
|
||||||
|
globals()[module_name] = cls
|
||||||
|
__all__.append(module_name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue