Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on 'selectable' interface for entry points. #2126

Merged
merged 11 commits into from
Jul 9, 2021
Merged
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))
jaraco marked this conversation as resolved.
Show resolved Hide resolved

@staticmethod
def entry_points():
Expand Down