From bbe79e4b0fe870ccc36cab7bfe7963b28d1948e3 Mon Sep 17 00:00:00 2001 From: Sal Hagen Date: Tue, 17 Sep 2024 15:12:46 +0200 Subject: [PATCH] Fix extension path walk for Windows --- common/lib/module_loader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/lib/module_loader.py b/common/lib/module_loader.py index 6d169d91..8a1792cb 100644 --- a/common/lib/module_loader.py +++ b/common/lib/module_loader.py @@ -97,9 +97,11 @@ def load_modules(self): """ # look for workers and processors in pre-defined folders and datasources + extension_path = Path(config.get('PATH_ROOT'), "extensions") + paths = [Path(config.get('PATH_ROOT'), "processors"), Path(config.get('PATH_ROOT'), "backend", "workers"), - Path(config.get('PATH_ROOT'), "extensions"), + extension_path, *[self.datasources[datasource]["path"] for datasource in self.datasources]] # extension datasources will be here and the above line... root_match = re.compile(r"^%s" % re.escape(str(config.get('PATH_ROOT')))) @@ -107,7 +109,7 @@ def load_modules(self): for folder in paths: # loop through folders, and files in those folders, recursively - is_extension = folder.is_relative_to(Path(config.get("PATH_ROOT"), "extensions")) + is_extension = extension_path in folder.parents or folder == extension_path for file in folder.rglob("*.py"): # determine module name for file # reduce path to be relative to 4CAT root