importlib_metadata deprecates the .get() method and provides
a different method .select() as of 3.7.1. Work around
the deprecation warning in this case.
Change-Id: I0f1849219e13a1c546f7bd24047d447823a15552
--- /dev/null
+.. change::
+ :tags: bug, misc
+
+ Adjusted the usage of the ``importlib_metadata`` library for loading
+ setuptools entrypoints in order to accommodate for some deprecation
+ changes.
+
if py38:
from importlib import metadata as importlib_metadata
+
+ def importlib_metadata_get(group):
+ return importlib_metadata.entry_points().get(group, ())
+
+
else:
import importlib_metadata # noqa
+ def importlib_metadata_get(group):
+ ep = importlib_metadata.entry_points()
+ if hasattr(ep, "select"):
+ return ep.select(group=group)
+ else:
+ return ep.get(group, ())
+
+
if py3k:
import base64
import builtins
self.impls[name] = loader
return loader()
- for impl in compat.importlib_metadata.entry_points().get(
- self.group, ()
- ):
+ for impl in compat.importlib_metadata_get(self.group):
if impl.name == name:
self.impls[name] = impl.load
return impl.load()