2
0
Fork 0

Fix entry point loading for python 3.8, 3.9

This commit is contained in:
Lance Edgar 2023-10-30 00:08:57 -05:00
parent 85aea9738c
commit 2a86f78b3e

View file

@ -76,9 +76,16 @@ def load_entry_points(group, ignore_errors=False):
entry_points[entry_point.name] = ep entry_points[entry_point.name] = ep
else: else:
# newer setup (python >= 3.8); can use importlib # newer setup (python >= 3.8); can use importlib, but the
# details may vary
eps = importlib.metadata.entry_points() eps = importlib.metadata.entry_points()
for entry_point in eps.select(group=group): if isinstance(eps, dict):
# python < 3.10
eps = eps.get(group, [])
else:
# python >= 3.10
eps = eps.select(group=group)
for entry_point in eps:
try: try:
ep = entry_point.load() ep = entry_point.load()
except: except: