From 531b556f41ae0fa45c9a29802b2eecb541cc83b5 Mon Sep 17 00:00:00 2001 From: Adam Charnock Date: Thu, 17 Aug 2023 11:24:55 +0200 Subject: [PATCH] More importlib compat fixes --- lightbus/commands/version.py | 2 ++ lightbus/utilities/importing.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lightbus/commands/version.py b/lightbus/commands/version.py index 61520f28..f2e12f43 100644 --- a/lightbus/commands/version.py +++ b/lightbus/commands/version.py @@ -3,6 +3,8 @@ import sys from pathlib import Path +from importlib.metadata import version as importlib_version + if sys.version_info < (3, 10): from importlib.metadata import entry_points as _entry_points diff --git a/lightbus/utilities/importing.py b/lightbus/utilities/importing.py index f0fa7549..da3954ea 100644 --- a/lightbus/utilities/importing.py +++ b/lightbus/utilities/importing.py @@ -41,5 +41,8 @@ def load_entrypoint_classes(entrypoint_name) -> Sequence[Tuple[str, str, Callabl found_classes = [] for entrypoint in entry_points(group=entrypoint_name): class_ = entrypoint.load() - found_classes.append((entrypoint.module, entrypoint.name, class_)) + if sys.version_info < (3, 9): + found_classes.append((entrypoint.module_name, entrypoint.name, class_)) + else: + found_classes.append((entrypoint.module, entrypoint.name, class_)) return found_classes