python-scikit-build/support-setuptools-69-3.patch
2024-06-03 06:11:13 +00:00

85 lines
3.2 KiB
Diff

From d0655bdcb9f27b9d64c582b947a7b56732f76c82 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Mon, 3 Jun 2024 15:53:10 +1000
Subject: [PATCH] Support setuptools 69.3.0 changes in two tests
setuptools 69.3.0 now canonicalizes package names in filenames, which
means all dashes are now converted to underscores, leading to test
failures due to FileNotFoundErrors. Handle both cases to support older
and newer setuptools.
---
tests/test_hello_cython.py | 23 ++++++++++++++---------
tests/test_hello_pure.py | 15 ++++++++++-----
2 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/tests/test_hello_cython.py b/tests/test_hello_cython.py
index dc95f697..1d9e944d 100644
--- a/tests/test_hello_cython.py
+++ b/tests/test_hello_cython.py
@@ -29,20 +29,25 @@ def test_hello_cython_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "hello-cython-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("hello_cython" in x for x in sdists_zip + sdists_tar):
+ dirname = "hello_cython-1.2.3"
+
expected_content = [
- "hello-cython-1.2.3/CMakeLists.txt",
- "hello-cython-1.2.3/hello/_hello.pyx",
- "hello-cython-1.2.3/hello/CMakeLists.txt",
- "hello-cython-1.2.3/hello/__init__.py",
- "hello-cython-1.2.3/hello/__main__.py",
- "hello-cython-1.2.3/setup.py",
+ f"{dirname}/CMakeLists.txt",
+ f"{dirname}/hello/_hello.pyx",
+ f"{dirname}/hello/CMakeLists.txt",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/hello/__main__.py",
+ f"{dirname}/setup.py",
]
- sdist_archive = "dist/hello-cython-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/hello-cython-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "hello-cython-1.2.3", expected_content, package_dir="hello")
+ check_sdist_content(sdist_archive, dirname, expected_content, package_dir="hello")
@project_setup_py_test("hello-cython", ["bdist_wheel"])
diff --git a/tests/test_hello_pure.py b/tests/test_hello_pure.py
index 21b0840b..cc176854 100644
--- a/tests/test_hello_pure.py
+++ b/tests/test_hello_pure.py
@@ -27,16 +27,21 @@ def test_hello_pure_sdist():
sdists_zip = glob.glob("dist/*.zip")
assert sdists_tar or sdists_zip
+ dirname = "hello-pure-1.2.3"
+ # setuptools 69.3.0 and above now canonicalize the filename as well.
+ if any("hello_pure" in x for x in sdists_zip + sdists_tar):
+ dirname = "hello_pure-1.2.3"
+
expected_content = [
- "hello-pure-1.2.3/hello/__init__.py",
- "hello-pure-1.2.3/setup.py",
+ f"{dirname}/hello/__init__.py",
+ f"{dirname}/setup.py",
]
- sdist_archive = "dist/hello-pure-1.2.3.zip"
+ sdist_archive = f"dist/{dirname}.zip"
if sdists_tar:
- sdist_archive = "dist/hello-pure-1.2.3.tar.gz"
+ sdist_archive = f"dist/{dirname}.tar.gz"
- check_sdist_content(sdist_archive, "hello-pure-1.2.3", expected_content)
+ check_sdist_content(sdist_archive, dirname, expected_content)
@project_setup_py_test("hello-pure", ["bdist_wheel"], disable_languages_test=True)