Use new entry_points interface

This commit is contained in:
Keoni Garner 2022-04-06 19:25:32 -07:00 committed by Asif Saif Uddin
parent 659c99a947
commit 54638f251b
1 changed files with 5 additions and 1 deletions

View File

@ -77,9 +77,13 @@ def detect_environment():
def entrypoints(namespace):
"""Return setuptools entrypoints for namespace."""
if sys.version_info >= (3,10):
entry_points = importlib_metadata.entry_points(group=namespace)
else:
entry_points = importlib_metadata.entry_points().get(namespace, [])
return (
(ep, ep.load())
for ep in importlib_metadata.entry_points().get(namespace, [])
for ep in entry_points
)