mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 22:56:15 +01:00
commandline: Append plugin dirs to sys.path to allow loading modules installed next to the plugins
This commit is contained in:
parent
9e0d7783d6
commit
497f4db18b
@ -259,6 +259,11 @@ class MainCommand(Command):
|
|||||||
def load_commands(self):
|
def load_commands(self):
|
||||||
for module_prefix, module_path in self.MODULES:
|
for module_prefix, module_path in self.MODULES:
|
||||||
module_path = os.path.expanduser(module_path)
|
module_path = os.path.expanduser(module_path)
|
||||||
|
|
||||||
|
# some plugins have their modules installed next to them instead of site-packages
|
||||||
|
if module_path not in sys.path:
|
||||||
|
sys.path.append(module_path)
|
||||||
|
|
||||||
for loader, module_name, _ in pkgutil.walk_packages(path=[module_path]):
|
for loader, module_name, _ in pkgutil.walk_packages(path=[module_path]):
|
||||||
full_name = f"{module_prefix}.{module_name}"
|
full_name = f"{module_prefix}.{module_name}"
|
||||||
spec = loader.find_spec(full_name)
|
spec = loader.find_spec(full_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user