From a851652ee64d3611a5194a77e1a93bc61a8f41b8 Mon Sep 17 00:00:00 2001 From: dgw Date: Mon, 7 Oct 2024 17:27:25 -0500 Subject: [PATCH] plugins.handlers: use dist name to look up EntryPointPlugin version --- sopel/plugins/handlers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sopel/plugins/handlers.py b/sopel/plugins/handlers.py index 784bae5d2..3ef85fc6b 100644 --- a/sopel/plugins/handlers.py +++ b/sopel/plugins/handlers.py @@ -620,11 +620,11 @@ def get_version(self) -> Optional[str]: if ( version is None - and hasattr(self.module, "__package__") - and self.module.__package__ is not None + and hasattr(self.entry_point, "dist") + and hasattr(self.entry_point.dist, "name") ): try: - version = importlib.metadata.version(self.module.__package__) + version = importlib.metadata.version(self.entry_point.dist.name) except Exception: # fine, just give up pass