You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.3 KiB
71 lines
2.3 KiB
From 5fe71e1126b6d4e5c3abc0d03c7c3709f1b1c1d4 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
Date: Mon, 6 Dec 2021 15:42:33 +0100
|
|
Subject: [PATCH] Use 'selectable' interface for entry points only when
|
|
available
|
|
|
|
This reverts commit 17caadc974cb2a24f70374525596cd1160579594.
|
|
---
|
|
docs/changelog/2246.feature.rst | 1 +
|
|
setup.cfg | 1 -
|
|
src/virtualenv/run/plugin/base.py | 15 +++++++++++++--
|
|
3 files changed, 14 insertions(+), 3 deletions(-)
|
|
create mode 100644 docs/changelog/2246.feature.rst
|
|
|
|
diff --git a/docs/changelog/2246.feature.rst b/docs/changelog/2246.feature.rst
|
|
new file mode 100644
|
|
index 0000000..4be877d
|
|
--- /dev/null
|
|
+++ b/docs/changelog/2246.feature.rst
|
|
@@ -0,0 +1 @@
|
|
+Drop the runtime dependency of ``backports.entry-points-selectable`` - by :user:`hroncok`.
|
|
diff --git a/setup.cfg b/setup.cfg
|
|
index 70d77fb..1cec841 100644
|
|
--- a/setup.cfg
|
|
+++ b/setup.cfg
|
|
@@ -40,7 +40,6 @@ project_urls =
|
|
[options]
|
|
packages = find:
|
|
install_requires =
|
|
- backports.entry_points_selectable>=1.0.4
|
|
distlib>=0.3.1,<1
|
|
filelock>=3.2,<4
|
|
platformdirs>=2,<3
|
|
diff --git a/src/virtualenv/run/plugin/base.py b/src/virtualenv/run/plugin/base.py
|
|
index f1f4ee0..048c76a 100644
|
|
--- a/src/virtualenv/run/plugin/base.py
|
|
+++ b/src/virtualenv/run/plugin/base.py
|
|
@@ -1,8 +1,16 @@
|
|
from __future__ import absolute_import, unicode_literals
|
|
|
|
+import sys
|
|
from collections import OrderedDict
|
|
|
|
-from backports.entry_points_selectable import entry_points
|
|
+if sys.version_info >= (3, 8):
|
|
+ from importlib.metadata import entry_points
|
|
+
|
|
+ importlib_metadata_version = ()
|
|
+else:
|
|
+ from importlib_metadata import entry_points, version
|
|
+
|
|
+ importlib_metadata_version = tuple(int(i) for i in version("importlib_metadata").split(".")[:2])
|
|
|
|
|
|
class PluginLoader(object):
|
|
@@ -11,7 +19,10 @@ class PluginLoader(object):
|
|
|
|
@classmethod
|
|
def entry_points_for(cls, key):
|
|
- return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
|
|
+ if sys.version_info >= (3, 10) or importlib_metadata_version >= (3, 6):
|
|
+ return OrderedDict((e.name, e.load()) for e in cls.entry_points().select(group=key))
|
|
+ else:
|
|
+ return OrderedDict((e.name, e.load()) for e in cls.entry_points().get(key, {}))
|
|
|
|
@staticmethod
|
|
def entry_points():
|
|
--
|
|
2.33.1
|
|
|