Skip to content

Commit 635975e

Browse files
committed
Use 'selectable' interface for entry points only when available
This reverts commit 17caadc.
1 parent f92eda6 commit 635975e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

setup.cfg

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ project_urls =
4040
[options]
4141
packages = find:
4242
install_requires =
43-
backports.entry-points-selectable>=1.0.4
4443
distlib>=0.3.1,<1
4544
filelock>=3.2,<4
4645
platformdirs>=2,<3

src/virtualenv/run/plugin/base.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
from __future__ import absolute_import, unicode_literals
22

3+
import sys
34
from collections import OrderedDict
45

5-
from backports.entry_points_selectable import entry_points
6+
if sys.version_info >= (3, 8):
7+
from importlib.metadata import entry_points
8+
9+
importlib_metadata_version = tuple()
10+
else:
11+
from importlib_metadata import entry_points, version
12+
13+
importlib_metadata_version = tuple(int(i) for i in version("importlib_metadata").split(".")[:2])
614

715

816
class PluginLoader(object):
@@ -11,7 +19,10 @@ class PluginLoader(object):
1119

1220
@classmethod
1321
def entry_points_for(cls, key):
14-
return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
22+
if sys.version_info >= (3, 10) or importlib_metadata_version >= (3, 6):
23+
return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
24+
else:
25+
return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
1526

1627
@staticmethod
1728
def entry_points():

0 commit comments

Comments
 (0)