From 09b97086bc6e6b789c69bb9446cf370a38f437fa Mon Sep 17 00:00:00 2001 From: Hemna Date: Sun, 21 Apr 2024 12:41:19 -0400 Subject: [PATCH] Added fox for entry_points with old python --- ChangeLog | 6 ++++++ aprsd/main.py | 17 ++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 76f76d6..cc0339e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,12 @@ CHANGES ======= +v3.3.4 +------ + +* Fixed entry\_points +* Fix for entry\_points where python < 3.10 + v3.3.3 ------ diff --git a/aprsd/main.py b/aprsd/main.py index 96d2249..3a01520 100644 --- a/aprsd/main.py +++ b/aprsd/main.py @@ -123,10 +123,25 @@ def check_version(ctx): def sample_config(ctx): """Generate a sample Config file from aprsd and all installed plugins.""" + def _get_selected_entry_points(): + import sys + if sys.version_info < (3, 10): + all = imp.entry_points() + selected = [] + if "oslo.config.opts" in all: + for x in all["oslo.config.opts"]: + if x.group == "oslo.config.opts": + selected.append(x) + else: + selected = imp.entry_points(group="oslo.config.opts") + + return selected + def get_namespaces(): args = [] - selected = imp.entry_points(group="oslo.config.opts") + # selected = imp.entry_points(group="oslo.config.opts") + selected = _get_selected_entry_points() for entry in selected: if "aprsd" in entry.name: args.append("--namespace")