Skip to content

Commit

Permalink
fix: import entrypoint module lookup (errbotio#1603)
Browse files Browse the repository at this point in the history
* fix: import entrypoint module lookup

This uses a more appropriate approach to find the plugins file location.

* docs: add info to CHANGES
  • Loading branch information
sijis authored and nzlosh committed Oct 20, 2022
1 parent 2063eb8 commit a49cc3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fixes:
- chore/setup: fix exception when installing on python <3.7 (#1585)
- docs: typos (#1589, #1594)
- chore: simplify isort config using black (#1595)
- fix: detecting entrypoint module paths (#1603)


v6.1.9 (2022-06-11)
Expand Down
4 changes: 3 additions & 1 deletion errbot/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import time
from functools import wraps
from importlib.util import find_spec

try:
from importlib.metadata import entry_points
Expand Down Expand Up @@ -205,7 +206,8 @@ def collect_roots(base_paths: List, file_sig: str = "*.plug") -> List:
def entry_point_plugins(group):
paths = []
for entry_point in entry_points().get(group, []):
paths.append(entry_point.dist._path.parent)
lib_paths = find_spec(entry_point.module).submodule_search_locations
paths.extend(lib_paths)
return paths


Expand Down

0 comments on commit a49cc3f

Please sign in to comment.