gnu: python-packaging: Fix test failures on non-x86_64 architectures.

* gnu/packages/patches/python-packaging-test-arch.patch: New file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
* gnu/packages/python-xyz.scm (python-packaging)[source](patches): New field.
This commit is contained in:
Marius Bakke 2020-01-16 17:20:22 +01:00
parent 7699e32289
commit fdd0c36963
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA
3 changed files with 67 additions and 0 deletions

View file

@ -1319,6 +1319,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-libxml2-utf8.patch \
%D%/packages/patches/python-mox3-python3.6-compat.patch \
%D%/packages/patches/python-testtools.patch \
%D%/packages/patches/python-packaging-test-arch.patch \
%D%/packages/patches/python-paste-remove-timing-test.patch \
%D%/packages/patches/python-pycrypto-CVE-2013-7459.patch \
%D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \

View file

@ -0,0 +1,65 @@
Fix tests that are "hard coded" to expect x86_64 output by mocking the platform interface.
Submitted upstream:
https://github.com/pypa/packaging/pull/176
diff --git a/tests/test_tags.py b/tests/test_tags.py
index 1eacf68..0a3f1b4 100644
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -435,37 +435,43 @@ class TestManylinuxPlatform:
linux_platform = list(tags._linux_platforms(is_32bit=False))
assert linux_platform == ["linux_x86_64"]
- def test_linux_platforms_manylinux1(self, monkeypatch):
+ def test_linux_platforms_manylinux1(self, is_x86, monkeypatch):
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux1"
)
- if platform.system() != "Linux":
+ if platform.system() != "Linux" or not is_x86:
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(platform, "machine", lambda: "x86_64")
platforms = list(tags._linux_platforms(is_32bit=False))
- assert platforms == ["manylinux1_x86_64", "linux_x86_64"]
+ arch = platform.machine()
+ assert platforms == ["manylinux1_" + arch, "linux_" + arch]
- def test_linux_platforms_manylinux2010(self, monkeypatch):
+ def test_linux_platforms_manylinux2010(self, is_x86, monkeypatch):
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux2010"
)
- if platform.system() != "Linux":
+ if platform.system() != "Linux" or not is_x86:
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(platform, "machine", lambda: "x86_64")
platforms = list(tags._linux_platforms(is_32bit=False))
- expected = ["manylinux2010_x86_64", "manylinux1_x86_64", "linux_x86_64"]
+ arch = platform.machine()
+ expected = ["manylinux2010_" + arch, "manylinux1_" + arch, "linux_" + arch]
assert platforms == expected
- def test_linux_platforms_manylinux2014(self, monkeypatch):
+ def test_linux_platforms_manylinux2014(self, is_x86, monkeypatch):
monkeypatch.setattr(
tags, "_is_manylinux_compatible", lambda name, _: name == "manylinux2014"
)
- if platform.system() != "Linux":
+ if platform.system() != "Linux" or not is_x86:
monkeypatch.setattr(distutils.util, "get_platform", lambda: "linux_x86_64")
+ monkeypatch.setattr(platform, "machine", lambda: "x86_64")
platforms = list(tags._linux_platforms(is_32bit=False))
+ arch = platform.machine()
expected = [
- "manylinux2014_x86_64",
- "manylinux2010_x86_64",
- "manylinux1_x86_64",
- "linux_x86_64",
+ "manylinux2014_" + arch,
+ "manylinux2010_" + arch,
+ "manylinux1_" + arch,
+ "linux_" + arch,
]
assert platforms == expected

View file

@ -13054,6 +13054,7 @@ (define-public python-packaging
(origin
(method url-fetch)
(uri (pypi-uri "packaging" version))
(patches (search-patches "python-packaging-test-arch.patch"))
(sha256
(base32
"1y2ip3a4ykkpgnwgn85j6hkspcl0cg3mzms97f40mk57vwqq67gy"))))