Compare commits
2 commits
stable
...
poc_relati
Author | SHA1 | Date | |
---|---|---|---|
Jordan ⌨️ | 56f252f588 | ||
Jordan ⌨️ | a9ef90c04e |
|
@ -1,5 +1,6 @@
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from . import shell, model, const
|
from . import shell, model, const
|
||||||
|
|
||||||
|
@ -17,6 +18,7 @@ def load(path: str):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
module = importlib.module_from_spec(spec)
|
module = importlib.module_from_spec(spec)
|
||||||
|
sys.modules["plugin"] = module
|
||||||
spec.loader.exec_module(module)
|
spec.loader.exec_module(module)
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,11 +35,11 @@ def loadAll():
|
||||||
|
|
||||||
for dirname in paths:
|
for dirname in paths:
|
||||||
pluginDir = os.path.join(project.dirname(), dirname, const.META_DIR, "plugins")
|
pluginDir = os.path.join(project.dirname(), dirname, const.META_DIR, "plugins")
|
||||||
|
initFile = os.path.join(pluginDir, "__init__.py")
|
||||||
|
|
||||||
for files in shell.readdir(pluginDir):
|
if os.path.isfile(initFile):
|
||||||
if files.endswith(".py"):
|
load(initFile)
|
||||||
plugin = load(os.path.join(pluginDir, files))
|
else:
|
||||||
|
for files in shell.readdir(pluginDir):
|
||||||
if plugin:
|
if files.endswith(".py"):
|
||||||
_logger.info(f"Loaded plugin {plugin.name}")
|
load(os.path.join(pluginDir, files))
|
||||||
plugin.init()
|
|
||||||
|
|
Loading…
Reference in a new issue