Merge Stable Changesto Master #9

Merged
itdominator merged 30 commits from develop into master 2022-11-29 04:58:09 +00:00
1 changed files with 11 additions and 1 deletions
Showing only changes of commit 72f0236e58 - Show all commits

View File

@ -72,13 +72,23 @@ class PluginsController:
def load_plugin_module(self, path, folder, target): def load_plugin_module(self, path, folder, target):
os.chdir(path) os.chdir(path)
spec = importlib.util.spec_from_file_location(folder, target, submodule_search_locations=path)
locations = []
self.collect_search_locations(path, locations)
spec = importlib.util.spec_from_file_location(folder, target, submodule_search_locations = locations)
module = importlib.util.module_from_spec(spec) module = importlib.util.module_from_spec(spec)
sys.modules[folder] = module sys.modules[folder] = module
spec.loader.exec_module(module) spec.loader.exec_module(module)
return module return module
def collect_search_locations(self, path, locations):
locations.append(path)
for file in os.listdir(path):
_path = os.path.join(path, file)
if os.path.isdir(_path):
self.collect_search_locations(_path, locations)
def execute_plugin(self, module: type, plugin: PluginInfo, loading_data: []): def execute_plugin(self, module: type, plugin: PluginInfo, loading_data: []):
plugin.reference = module.Plugin() plugin.reference = module.Plugin()