Skip to content

Commit

Permalink
Rely on 'selectable' interface for entry points. (#2126)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jaraco and pre-commit-ci[bot] authored Jul 9, 2021
1 parent 03afeca commit 17caadc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions docs/changelog/2093.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Plugins now use 'selectable' entry points.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ project_urls =
packages = find:
install_requires =
appdirs>=1.4.3,<2
backports.entry_points_selectable>=1.0.4
distlib>=0.3.1,<1
filelock>=3.0.0,<4
six>=1.9.0,<2 # keep it >=1.9.0 as it may cause problems on LTS platforms
Expand Down
8 changes: 2 additions & 6 deletions src/virtualenv/run/plugin/base.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from __future__ import absolute_import, unicode_literals

import sys
from collections import OrderedDict

if sys.version_info >= (3, 8):
from importlib.metadata import entry_points
else:
from importlib_metadata import entry_points
from backports.entry_points_selectable import entry_points


class PluginLoader(object):
Expand All @@ -15,7 +11,7 @@ class PluginLoader(object):

@classmethod
def entry_points_for(cls, key):
return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))

@staticmethod
def entry_points():
Expand Down

0 comments on commit 17caadc

Please sign in to comment.