From 2a86f78b3e311f1b1fad787c514c4bd21bc5f8de Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 30 Oct 2023 00:08:57 -0500 Subject: [PATCH] Fix entry point loading for python 3.8, 3.9 --- src/wuttjamaican/util.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wuttjamaican/util.py b/src/wuttjamaican/util.py index 2f7d846..296eec7 100644 --- a/src/wuttjamaican/util.py +++ b/src/wuttjamaican/util.py @@ -76,9 +76,16 @@ def load_entry_points(group, ignore_errors=False): entry_points[entry_point.name] = ep 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() - 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: ep = entry_point.load() except: