Skip to content

Commit 131effd

Browse files
authored
Merge pull request ceph#57650 from tchaikov/wip-use-importlib
ceph-volume: use importlib from stdlib on Python 3.8 and up Reviewed-by: John Mulligan <[email protected]>
2 parents 51f8aa7 + 24f8e5c commit 131effd

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ceph-volume/ceph_volume/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
from __future__ import print_function
22
import argparse
33
import os
4-
import pkg_resources
54
import sys
65
import logging
76

7+
try:
8+
from importlib.metadata import entry_points
9+
except ImportError:
10+
from pkg_resources import iter_entry_points as entry_points
11+
12+
813
from ceph_volume.decorators import catches
914
from ceph_volume import log, devices, configuration, conf, exceptions, terminal, inventory, drive_group, activate
1015

@@ -170,9 +175,9 @@ def _load_library_extensions():
170175
"""
171176
logger = logging.getLogger('ceph_volume.plugins')
172177
group = 'ceph_volume_handlers'
173-
entry_points = pkg_resources.iter_entry_points(group=group)
178+
174179
plugins = []
175-
for ep in entry_points:
180+
for ep in entry_points(group=group):
176181
try:
177182
logger.debug('loading %s' % ep.name)
178183
plugin = ep.load()

0 commit comments

Comments
 (0)