Always drop the dependency on backports.entry-points-selectable
This commit is contained in:
parent
192e39e1a9
commit
d7ea69e6ab
70
2246.patch
Normal file
70
2246.patch
Normal file
@ -0,0 +1,70 @@
|
||||
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
|
||||
|
@ -13,6 +13,12 @@ Patch1: rpm-wheels.patch
|
||||
# Hotfix for the test of the new functionality
|
||||
Patch2: https://github.com/pypa/virtualenv/pull/2231.patch
|
||||
|
||||
# Use 'selectable' interface for entry points only when available
|
||||
# Drops the dependency on backports.entry-points-selectable
|
||||
# https://github.com/pypa/virtualenv/pull/2246
|
||||
# Rebased to apply
|
||||
Patch3: 2246.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: python3-devel
|
||||
@ -98,13 +104,6 @@ Documentation for python virtualenv.
|
||||
%autosetup -p1 -n virtualenv-%{version}
|
||||
sed -i -e "1s|#!/usr/bin/env python||" tasks/update_embedded.py
|
||||
|
||||
# The version of importlib.metadata we have in Python 3.10 in rawhide
|
||||
# is new enough so we do not need this compatibility package.
|
||||
# For older releases, we just need to switch this to importlib_metadata
|
||||
# and add appropriate runtime dependency (importlib_metadate>=3.6).
|
||||
sed -i "s/backports.entry_points_selectable/importlib.metadata/" src/virtualenv/run/plugin/base.py
|
||||
sed -i "/backports.entry_points_selectable/d" setup.cfg
|
||||
|
||||
# Remove the wheels provided by RPM packages
|
||||
rm src/virtualenv/seed/wheels/embed/pip-*
|
||||
rm src/virtualenv/seed/wheels/embed/setuptools-*
|
||||
|
Loading…
Reference in New Issue
Block a user