Skip to content

Commit

Permalink
Opportunistically use "selectable" entry_points.
Browse files Browse the repository at this point in the history
The “selectable” entry points were introduced in importlib_metadata 3.6 and Python 3.10.
While this could be solved by adding entry_points>=3.6 for python<3.10 as a dependency, python3-importib-metadata el8 package currently only have version 0.23.
Fixes deprecation warnings.
See: python/importlib_metadata#298
  • Loading branch information
martinhoyer authored and happz committed Jun 1, 2023
1 parent a2f394e commit 02ca120
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tmt/plugins/__init__.py
Expand Up @@ -115,7 +115,13 @@ def _explore_entry_point(entry_point: str, logger: Logger) -> None:
logger = logger.descend()

try:
for found in entry_points()[entry_point]:
eps = entry_points()
if hasattr(eps, "select"):
entry_point_group = eps.select(group=entry_point)
else:
entry_point_group = eps[entry_point]

for found in entry_point_group:
logger.debug(f"Loading plugin '{found.name}' ({found.value}).")
found.load()

Expand Down

0 comments on commit 02ca120

Please sign in to comment.