Skip to content

Commit 17caadc

Browse files
Rely on 'selectable' interface for entry points. (#2126)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 03afeca commit 17caadc

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

docs/changelog/2093.misc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Plugins now use 'selectable' entry points.

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ project_urls =
4141
packages = find:
4242
install_requires =
4343
appdirs>=1.4.3,<2
44+
backports.entry_points_selectable>=1.0.4
4445
distlib>=0.3.1,<1
4546
filelock>=3.0.0,<4
4647
six>=1.9.0,<2 # keep it >=1.9.0 as it may cause problems on LTS platforms

src/virtualenv/run/plugin/base.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
from __future__ import absolute_import, unicode_literals
22

3-
import sys
43
from collections import OrderedDict
54

6-
if sys.version_info >= (3, 8):
7-
from importlib.metadata import entry_points
8-
else:
9-
from importlib_metadata import entry_points
5+
from backports.entry_points_selectable import entry_points
106

117

128
class PluginLoader(object):
@@ -15,7 +11,7 @@ class PluginLoader(object):
1511

1612
@classmethod
1713
def entry_points_for(cls, key):
18-
return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
14+
return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
1915

2016
@staticmethod
2117
def entry_points():

0 commit comments

Comments
 (0)