From c451e266c71827867a21c7a38df2498ff693e123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Tue, 21 Mar 2023 17:08:44 +0100 Subject: [PATCH] BUG: fix plugin iteration on Python 3.8 and 3.9 --- glue/_plugin_helpers.py | 13 ++++++------- setup.cfg | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/glue/_plugin_helpers.py b/glue/_plugin_helpers.py index 5f9a85551..52820b6c7 100644 --- a/glue/_plugin_helpers.py +++ b/glue/_plugin_helpers.py @@ -9,16 +9,15 @@ import os import sys from collections import defaultdict -from importlib.metadata import entry_points +if sys.version_info >= (3, 10): + from importlib.metadata import entry_points +else: + from importlib_metadata import entry_points -def iter_plugin_entry_points(): - if sys.version_info >= (3, 10): - plugins = entry_points(group='glue.plugins') - else: - plugins = entry_points().get('glue.plugins', []) - return iter(plugins) +def iter_plugin_entry_points(): + return iter(entry_points(group='glue.plugins')) class PluginConfig(object): diff --git a/setup.cfg b/setup.cfg index c9f4346bf..495653af3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -44,6 +44,7 @@ install_requires = mpl-scatter-density>=0.7 pvextractor>=0.2 importlib_resources>=1.3; python_version<'3.9' + importlib_metadata>=3.6; python_version<'3.10' [options.entry_points] glue.plugins =