Skip to content

Commit

Permalink
plugins.handlers: use dist name to look up EntryPointPlugin version
Browse files Browse the repository at this point in the history
  • Loading branch information
dgw committed Oct 7, 2024
1 parent 3c7a335 commit bd3e145
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sopel/plugins/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,14 +613,13 @@ 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:
# Just give up
# Can be caused by empty package name, mismatch between package/project names
# fine, just give up
pass

return version
Expand Down

0 comments on commit bd3e145

Please sign in to comment.