Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion odev/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# or merged change.
# ------------------------------------------------------------------------------

__version__ = "4.24.0"
__version__ = "4.24.1"

Check notice on line 25 in odev/_version.py

View workflow job for this annotation

GitHub Actions / version-bump

Patch Update
19 changes: 19 additions & 0 deletions odev/common/odev.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ def _register_plugin_commands(self) -> None:
except ImportError as error:
logger.debug(f"Could not import plugin module {plugin.path.name}: {error}")

self._import_plugin_common_modules(plugin)

for command_class in self.import_commands(plugin.path.glob("commands/**")):
command_names = [command_class._name] + (list(command_class._aliases) or [])
base_command_class = self.commands.get(command_class._name)
Expand All @@ -620,6 +622,23 @@ class PatchedCommand(command_class, base_command_class, *base_command_class.__ba
command_class.prepare_command(self)
self.commands.update(dict.fromkeys(command_names, command_class))

def _import_plugin_common_modules(self, plugin) -> None:
"""Import every submodule under a plugin's `common/` directory so their
import-time side effects (subclass registration, decorators, patches) run.
"""
common_path = plugin.path / "common"
if not common_path.is_dir():
return

for module_info in pkgutil.iter_modules([common_path.as_posix()]):
module_name = f"odev.plugins.{plugin.path.name}.common.{module_info.name}"
if module_name in sys.modules:
continue
try:
importlib.import_module(module_name)
except ImportError as error:
logger.debug(f"Could not import common module {module_info.name} from plugin {plugin.name!r}: {error}")

def _load_config(self) -> None:
"""Reload the configuration file."""
self.__class__.config = Config(self.name)
Expand Down
Loading