Migrate to importlib.metadata
pkg_resources is removed in Python 3.12. Change-Id: I6ea6d9eb098378dbab52cceb9aa6df335ef9407b Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
87c586051f
commit
db14d97dbf
@ -2,3 +2,5 @@ WebOb>=1.8.0
|
|||||||
simplegeneric
|
simplegeneric
|
||||||
pytz
|
pytz
|
||||||
netaddr>=0.7.12
|
netaddr>=0.7.12
|
||||||
|
# TODO: Drop this when Python 3.10 is our minimum supported version
|
||||||
|
importlib_metadata>=4.4 # Apache-2.0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
import pkg_resources
|
import importlib_metadata
|
||||||
|
|
||||||
from wsme.exc import ClientSideError
|
from wsme.exc import ClientSideError
|
||||||
|
|
||||||
@ -106,8 +106,9 @@ def register_protocol(protocol):
|
|||||||
def getprotocol(name, **options):
|
def getprotocol(name, **options):
|
||||||
protocol_class = registered_protocols.get(name)
|
protocol_class = registered_protocols.get(name)
|
||||||
if protocol_class is None:
|
if protocol_class is None:
|
||||||
for entry_point in pkg_resources.iter_entry_points(
|
for entry_point in importlib_metadata.entry_points().select(
|
||||||
'wsme.protocols', name):
|
group='wsme.protocols',
|
||||||
|
):
|
||||||
if entry_point.name == name:
|
if entry_point.name == name:
|
||||||
protocol_class = entry_point.load()
|
protocol_class = entry_point.load()
|
||||||
if protocol_class is None:
|
if protocol_class is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user