1
0
mirror of https://github.com/craigerl/aprsd.git synced 2025-07-08 03:45:16 -04:00

reworked usage of importlib.metadata

For whatever reason passing in group in python 3.9.x
fails for importlib_metadata.entry_points.  This patch
fetches all and filters through them to get the real
oslo.config.opts entry points now.  This is to find all
of the config options of aprsd and the plugins
This commit is contained in:
Hemna 2023-01-02 14:12:31 -05:00
parent 29b8764124
commit a5520b2cd3

@ -21,7 +21,7 @@
# python included libs # python included libs
import datetime import datetime
from importlib.metadata import entry_points import importlib.metadata as imp
from importlib.metadata import version as metadata_version from importlib.metadata import version as metadata_version
import logging import logging
import os import os
@ -112,6 +112,8 @@ def check_version(ctx):
click.secho(msg, fg="green") click.secho(msg, fg="green")
@cli.command() @cli.command()
@click.pass_context @click.pass_context
def sample_config(ctx): def sample_config(ctx):
@ -120,7 +122,12 @@ def sample_config(ctx):
def get_namespaces(): def get_namespaces():
args = [] args = []
selected = entry_points(group="oslo.config.opts") 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)
for entry in selected: for entry in selected:
if "aprsd" in entry.name: if "aprsd" in entry.name:
args.append("--namespace") args.append("--namespace")