Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog committed Oct 9, 2024
1 parent 379282c commit 42d6385
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/spiffworkflow_proxy/plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,35 @@ def command_named(plugin_display_name: str, command_name: str) -> type[Connector
except Exception:
return None

#
# commands True connector_example.commands
# combine_strings False connector_example.commands.combine_strings
# some_helper False connector_example.some_helper
#

@staticmethod
def modules_for_plugin_in_package2(
plugin: types.ModuleType, package_name: str | None
) -> Generator[tuple[str, types.ModuleType], None, None]:
for finder, name, ispkg in pkgutil.iter_modules(plugin.__path__):
print(name, ispkg, f"{plugin.__name__}.{name}")
imported = importlib.import_module(f"{plugin.__name__}.{name}")
if ispkg:
yield from PluginService.modules_for_plugin_in_package(imported, None)
else:
yield name, imported

#
# commands True connector_example.commands
# combine_strings False commands.combine_strings
#

@staticmethod
def modules_for_plugin_in_package(
plugin: types.ModuleType, package_name: str | None
) -> Generator[tuple[str, types.ModuleType], None, None]:
for finder, name, ispkg in pkgutil.iter_modules(plugin.__path__):
print(name, ispkg, f"{plugin.__name__}.{name}")
if ispkg and name == package_name:
found_module = finder.find_module(name) # type: ignore
if found_module is not None:
Expand All @@ -93,6 +117,7 @@ def modules_for_plugin_in_package(
module = types.ModuleType(spec.name)
spec.loader.exec_module(module)
yield name, module
assert False

@staticmethod
def targets_for_plugin(
Expand Down

0 comments on commit 42d6385

Please sign in to comment.