Accepting request 904140 from home:alarrosa:branches:devel:languages:python

- Add patch to remove a dependency cycle between
  python-more-itertools and python-setuptools (which requires the
  former just for one simple function):
  * remove-more-itertools-dependency-cycle.patch

OBS-URL: https://build.opensuse.org/request/show/904140
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-setuptools?expand=0&rev=217
This commit is contained in:
Steve Kowalik 2021-07-05 11:33:23 +00:00 committed by Git OBS Bridge
parent 9195e8307b
commit e017d2b69f
3 changed files with 118 additions and 2 deletions

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Jul 5 09:22:44 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- Add patch to remove a dependency cycle between
python-more-itertools and python-setuptools (which requires the
former just for one simple function):
* remove-more-itertools-dependency-cycle.patch
-------------------------------------------------------------------
Fri Jun 25 12:46:26 UTC 2021 - Ben Greiner <code@bnavigator.de>

View File

@ -45,8 +45,9 @@ Source: https://files.pythonhosted.org/packages/source/s/setuptools/setu
Patch0: sort-for-reproducibility.patch
# PATCH-FIX-OPENSUSE remove_mock.patch mcepl@suse.com
Patch1: remove_mock.patch
# PATCH-FIX-OPENSUSE remove-more-itertools-dependency-cycle.patch alarrosa@suse.com
Patch2: remove-more-itertools-dependency-cycle.patch
BuildRequires: %{python_module appdirs >= 1.4.3}
BuildRequires: %{python_module more-itertools >= 8.8.0}
BuildRequires: %{python_module ordered-set >= 3.1.1}
BuildRequires: %{python_module packaging >= 20.4}
BuildRequires: %{python_module pyparsing >= 2.2.1}
@ -56,7 +57,6 @@ BuildRequires: python-rpm-macros
BuildRequires: unzip
Requires: python-appdirs >= 1.4.3
Requires: python-base >= 3.6
Requires: python-more-itertools >= 8.8.0
Requires: python-ordered-set >= 3.1.1
Requires: python-packaging >= 20.4
Requires: python-pyparsing >= 2.2.1

View File

@ -0,0 +1,108 @@
From: Antonio Larrosa <alarrosa@suse.com>
Subject: Remove dependency on more_itertools which generates a dependency cycle
setuptools buildrequires more_itertools just for one simple function
(unique_everseen) and more_itertools buildrequires setuptools, so
in order to remove the cycle, the unique_everseen function is copied
here so that it can be used without buildrequiring the external package.
Index: setuptools-57.0.0/setuptools/extern/__init__.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/extern/__init__.py
+++ setuptools-57.0.0/setuptools/extern/__init__.py
@@ -69,5 +69,5 @@ class VendorImporter:
sys.meta_path.append(self)
-names = 'packaging', 'pyparsing', 'ordered_set', 'more_itertools',
+names = 'packaging', 'pyparsing', 'ordered_set'
VendorImporter(__name__, names, 'setuptools._vendor').install()
Index: setuptools-57.0.0/setuptools/dist.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/dist.py
+++ setuptools-57.0.0/setuptools/dist.py
@@ -29,7 +29,7 @@ from distutils.version import StrictVers
from setuptools.extern import packaging
from setuptools.extern import ordered_set
-from setuptools.extern.more_itertools import unique_everseen
+from setuptools.more_itertools import unique_everseen
from . import SetuptoolsDeprecationWarning
Index: setuptools-57.0.0/setuptools/more_itertools.py
===================================================================
--- /dev/null
+++ setuptools-57.0.0/setuptools/more_itertools.py
@@ -0,0 +1,19 @@
+def unique_everseen(iterable, key=None):
+ """Yield unique elements, preserving order."""
+
+ seenset = set()
+ seenset_add = seenset.add
+ seenlist = []
+ seenlist_add = seenlist.append
+ use_key = key is not None
+
+ for element in iterable:
+ k = key(element) if use_key else element
+ try:
+ if k not in seenset:
+ seenset_add(k)
+ yield element
+ except TypeError:
+ if k not in seenlist:
+ seenlist_add(k)
+ yield element
Index: setuptools-57.0.0/setuptools/command/build_py.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/command/build_py.py
+++ setuptools-57.0.0/setuptools/command/build_py.py
@@ -8,7 +8,7 @@ import io
import distutils.errors
import itertools
import stat
-from setuptools.extern.more_itertools import unique_everseen
+from setuptools.more_itertools import unique_everseen
try:
from setuptools.lib2to3_ex import Mixin2to3
Index: setuptools-57.0.0/setuptools/msvc.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/msvc.py
+++ setuptools-57.0.0/setuptools/msvc.py
@@ -30,7 +30,7 @@ import itertools
import subprocess
import distutils.errors
from setuptools.extern.packaging.version import LegacyVersion
-from setuptools.extern.more_itertools import unique_everseen
+from setuptools.more_itertools import unique_everseen
from .monkey import get_unpatched
Index: setuptools-57.0.0/setuptools/package_index.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/package_index.py
+++ setuptools-57.0.0/setuptools/package_index.py
@@ -28,7 +28,7 @@ from distutils import log
from distutils.errors import DistutilsError
from fnmatch import translate
from setuptools.wheel import Wheel
-from setuptools.extern.more_itertools import unique_everseen
+from setuptools.more_itertools import unique_everseen
EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$')
Index: setuptools-57.0.0/setuptools/command/test.py
===================================================================
--- setuptools-57.0.0.orig/setuptools/command/test.py
+++ setuptools-57.0.0/setuptools/command/test.py
@@ -12,7 +12,7 @@ from pkg_resources import (resource_list
working_set, _namespace_packages, evaluate_marker,
add_activation_listener, require, EntryPoint)
from setuptools import Command
-from setuptools.extern.more_itertools import unique_everseen
+from setuptools.more_itertools import unique_everseen
class ScanningLoader(TestLoader):