forked from pool/python-packaging
Accepting request 724501 from home:dancermak:branches:devel:languages:python
drop dependency on attrs OBS-URL: https://build.opensuse.org/request/show/724501 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-packaging?expand=0&rev=30
This commit is contained in:
parent
b8f1af4c0c
commit
e1805b374c
@ -1,7 +1,7 @@
|
|||||||
From ee35f4ff365c3a65872f2d2ba5320c6673a5859a Mon Sep 17 00:00:00 2001
|
From ee35f4ff365c3a65872f2d2ba5320c6673a5859a Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
Date: Thu, 8 Aug 2019 14:39:57 +0200
|
Date: Thu, 8 Aug 2019 14:39:57 +0200
|
||||||
Subject: [PATCH 1/4] Fix test failures test_linux_platforms_manylinux* for non
|
Subject: [PATCH 1/5] Fix test failures test_linux_platforms_manylinux* for non
|
||||||
x86_64
|
x86_64
|
||||||
|
|
||||||
Theses tests are implicitly assuming that they are being run on x86_64 or i686,
|
Theses tests are implicitly assuming that they are being run on x86_64 or i686,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 73c4a178654cf0ffe64d2f10155f7d7978f3622d Mon Sep 17 00:00:00 2001
|
From 73c4a178654cf0ffe64d2f10155f7d7978f3622d Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
Date: Thu, 8 Aug 2019 15:44:09 +0200
|
Date: Thu, 8 Aug 2019 15:44:09 +0200
|
||||||
Subject: [PATCH 2/4] Fix check for 64 bit OS
|
Subject: [PATCH 2/5] Fix check for 64 bit OS
|
||||||
|
|
||||||
distutils.util.get_platform() returns "linux-x86_64" on 64 bit Linux and not
|
distutils.util.get_platform() returns "linux-x86_64" on 64 bit Linux and not
|
||||||
"linux_86_64" as assumed by this function. Instead we use the first element
|
"linux_86_64" as assumed by this function. Instead we use the first element
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From e25b14f0ab054dbde4c2bf274f938a0f74ebb823 Mon Sep 17 00:00:00 2001
|
From e25b14f0ab054dbde4c2bf274f938a0f74ebb823 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
Date: Thu, 8 Aug 2019 15:45:12 +0200
|
Date: Thu, 8 Aug 2019 15:45:12 +0200
|
||||||
Subject: [PATCH 3/4] Add additional test to get 100% branch coverage
|
Subject: [PATCH 3/5] Add additional test to get 100% branch coverage
|
||||||
|
|
||||||
the else: branch was not covered in tags._linux_platforms() due to the from the
|
the else: branch was not covered in tags._linux_platforms() due to the from the
|
||||||
previous commit
|
previous commit
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From d691f8387975b426585bb197fc3f8d8ad6ba02c2 Mon Sep 17 00:00:00 2001
|
From d691f8387975b426585bb197fc3f8d8ad6ba02c2 Mon Sep 17 00:00:00 2001
|
||||||
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
Date: Thu, 8 Aug 2019 15:54:48 +0200
|
Date: Thu, 8 Aug 2019 15:54:48 +0200
|
||||||
Subject: [PATCH 4/4] Fix test_macos_version_detection failure on 32 bit Linux
|
Subject: [PATCH 4/5] Fix test_macos_version_detection failure on 32 bit Linux
|
||||||
|
|
||||||
tags._mac_arch always returns i386 on 32 bit Linux and thereby
|
tags._mac_arch always returns i386 on 32 bit Linux and thereby
|
||||||
tags._mac_platforms()[0] ends with "i386" even in the arch="x86_64" case
|
tags._mac_platforms()[0] ends with "i386" even in the arch="x86_64" case
|
||||||
|
107
0005-Drop-dependency-on-attrs.patch
Normal file
107
0005-Drop-dependency-on-attrs.patch
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
From 3731ce275df3061d84a6014ec732747e5ae5819e Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
|
Date: Tue, 13 Aug 2019 11:57:09 +0200
|
||||||
|
Subject: [PATCH 5/5] Drop dependency on attrs
|
||||||
|
|
||||||
|
- replace tags.Tag with a custom implementation instead of using @attr.s
|
||||||
|
- add a sanity check for __hash__()
|
||||||
|
- drop attrs from setup.py
|
||||||
|
|
||||||
|
This fixes #178
|
||||||
|
---
|
||||||
|
packaging/tags.py | 37 ++++++++++++++++++++++++++++++-------
|
||||||
|
setup.py | 2 +-
|
||||||
|
tests/test_tags.py | 6 ++++++
|
||||||
|
3 files changed, 37 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/packaging/tags.py b/packaging/tags.py
|
||||||
|
index c472b58..c9b5119 100644
|
||||||
|
--- a/packaging/tags.py
|
||||||
|
+++ b/packaging/tags.py
|
||||||
|
@@ -11,8 +11,6 @@ import sys
|
||||||
|
import sysconfig
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
-import attr
|
||||||
|
-
|
||||||
|
|
||||||
|
INTERPRETER_SHORT_NAMES = {
|
||||||
|
"python": "py", # Generic.
|
||||||
|
@@ -26,14 +24,39 @@ INTERPRETER_SHORT_NAMES = {
|
||||||
|
_32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
|
||||||
|
|
||||||
|
|
||||||
|
-@attr.s(frozen=True, repr=False)
|
||||||
|
class Tag(object):
|
||||||
|
- interpreter = attr.ib(converter=str.lower)
|
||||||
|
- abi = attr.ib(converter=str.lower)
|
||||||
|
- platform = attr.ib(converter=str.lower)
|
||||||
|
+
|
||||||
|
+ __slots__ = ["_interpreter", "_abi", "_platform"]
|
||||||
|
+
|
||||||
|
+ def __init__(self, interpreter, abi, platform):
|
||||||
|
+ self._interpreter = str.lower(interpreter)
|
||||||
|
+ self._abi = str.lower(abi)
|
||||||
|
+ self._platform = str.lower(platform)
|
||||||
|
+
|
||||||
|
+ @property
|
||||||
|
+ def interpreter(self):
|
||||||
|
+ return self._interpreter
|
||||||
|
+
|
||||||
|
+ @property
|
||||||
|
+ def abi(self):
|
||||||
|
+ return self._abi
|
||||||
|
+
|
||||||
|
+ @property
|
||||||
|
+ def platform(self):
|
||||||
|
+ return self._platform
|
||||||
|
+
|
||||||
|
+ def __eq__(self, other):
|
||||||
|
+ return (
|
||||||
|
+ (self.platform == other.platform)
|
||||||
|
+ and (self.abi == other.abi)
|
||||||
|
+ and (self.interpreter == other.interpreter)
|
||||||
|
+ )
|
||||||
|
+
|
||||||
|
+ def __hash__(self):
|
||||||
|
+ return hash((self._interpreter, self._abi, self._platform))
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
- return "{}-{}-{}".format(self.interpreter, self.abi, self.platform)
|
||||||
|
+ return "{}-{}-{}".format(self._interpreter, self._abi, self._platform)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return "<{self} @ {self_id}>".format(self=self, self_id=id(self))
|
||||||
|
diff --git a/setup.py b/setup.py
|
||||||
|
index 874512b..23007c7 100644
|
||||||
|
--- a/setup.py
|
||||||
|
+++ b/setup.py
|
||||||
|
@@ -48,7 +48,7 @@ setup(
|
||||||
|
author=about["__author__"],
|
||||||
|
author_email=about["__email__"],
|
||||||
|
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
|
||||||
|
- install_requires=["attrs", "pyparsing>=2.0.2", "six"], # Needed to avoid issue #91
|
||||||
|
+ install_requires=["pyparsing>=2.0.2", "six"], # Needed to avoid issue #91
|
||||||
|
classifiers=[
|
||||||
|
"Development Status :: 5 - Production/Stable",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
diff --git a/tests/test_tags.py b/tests/test_tags.py
|
||||||
|
index 0bb4fd6..a6d50f3 100644
|
||||||
|
--- a/tests/test_tags.py
|
||||||
|
+++ b/tests/test_tags.py
|
||||||
|
@@ -43,6 +43,12 @@ def test_tag_hashing(example_tag):
|
||||||
|
assert example_tag in tags
|
||||||
|
|
||||||
|
|
||||||
|
+def test_tag_hash_equality(example_tag):
|
||||||
|
+ equal_tag = tags.Tag("py3", "none", "any")
|
||||||
|
+ assert example_tag == equal_tag
|
||||||
|
+ assert example_tag.__hash__() == equal_tag.__hash__()
|
||||||
|
+
|
||||||
|
+
|
||||||
|
def test_tag_str(example_tag):
|
||||||
|
assert str(example_tag) == "py3-none-any"
|
||||||
|
|
||||||
|
--
|
||||||
|
2.22.0
|
||||||
|
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Aug 19 08:15:30 UTC 2019 - Dan Čermák <dcermak@suse.com>
|
||||||
|
|
||||||
|
- Remove dependency on attrs
|
||||||
|
Add: 0005-Drop-dependency-on-attrs.patch
|
||||||
|
this fixes bsc#1144506
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Thu Aug 15 08:35:19 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
Thu Aug 15 08:35:19 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ Patch0: 0001-Fix-test-failures-test_linux_platforms_manylinux-for.patch
|
|||||||
Patch1: 0002-Fix-check-for-64-bit-OS.patch
|
Patch1: 0002-Fix-check-for-64-bit-OS.patch
|
||||||
Patch2: 0003-Add-additional-test-to-get-100-branch-coverage.patch
|
Patch2: 0003-Add-additional-test-to-get-100-branch-coverage.patch
|
||||||
Patch3: 0004-Fix-test_macos_version_detection-failure-on-32-bit-L.patch
|
Patch3: 0004-Fix-test_macos_version_detection-failure-on-32-bit-L.patch
|
||||||
|
Patch4: 0005-Drop-dependency-on-attrs.patch
|
||||||
BuildRequires: %{python_module six}
|
BuildRequires: %{python_module six}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
@ -64,6 +65,7 @@ Core utilities for Python packages
|
|||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
%patch2 -p1
|
%patch2 -p1
|
||||||
%patch3 -p1
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
# sdist must provide a packaging.egg-info, used below in install phase
|
# sdist must provide a packaging.egg-info, used below in install phase
|
||||||
test -d packaging.egg-info
|
test -d packaging.egg-info
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user