git: 59e716676bad - main - devel/py-cibuildwheel: update 4.1.1 → 4.2.1

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 02:33:16 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=59e716676bada0800114b15248d89dced050ac77

commit 59e716676bada0800114b15248d89dced050ac77
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-09-15 00:41:38 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-09-15 02:33:07 +0000

    devel/py-cibuildwheel: update 4.1.1 → 4.2.1
---
 devel/py-cibuildwheel/Makefile                     | 22 +++++-
 devel/py-cibuildwheel/distinfo                     |  6 +-
 .../files/patch-cibuildwheel_architecture.py       | 84 ++++++++++++++++++----
 .../patch-cibuildwheel_platforms_____init____.py   | 22 ++++++
 .../files/patch-cibuildwheel_typing.py             | 14 ++++
 devel/py-cibuildwheel/files/patch-pyproject.toml   | 16 +++++
 ...-unit__test_main__tests_main__platform__test.py | 10 ++-
 .../patch-unit__test_validate__schema__test.py     | 31 ++++++++
 8 files changed, 183 insertions(+), 22 deletions(-)

diff --git a/devel/py-cibuildwheel/Makefile b/devel/py-cibuildwheel/Makefile
index ac787fda0264..69b7548f13f4 100644
--- a/devel/py-cibuildwheel/Makefile
+++ b/devel/py-cibuildwheel/Makefile
@@ -1,19 +1,19 @@
 PORTNAME=	cibuildwheel # doesn't fully support FreeBSD
-DISTVERSION=	4.1.1
+DISTVERSION=	4.2.1
 CATEGORIES=	devel science
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
 
 MAINTAINER=	yuri@FreeBSD.org
 COMMENT=	Build Python wheels on CI with minimal configuration
-WWW=		https://cibuildwheel.pypa.io/en/stable \
+WWW=		https://cibuildwheel.pypa.io/en/stable/ \
 		https://github.com/pypa/cibuildwheel
 
 LICENSE=	BSD2CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}hatchling>=0:devel/py-hatchling@${PY_FLAVOR}
-RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bashlex>=0.14:devel/py-bashlex@${PY_FLAVOR} \
+RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bashlex>=0.13:devel/py-bashlex@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}bracex>0:textproc/py-bracex@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}build>=1.0.0:devel/py-build@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}certifi>0:security/py-certifi@${PY_FLAVOR} \
@@ -22,13 +22,29 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}bashlex>=0.14:devel/py-bashlex@${PY_FLAVOR}
 		${PYTHON_PKGNAMEPREFIX}humanize>0:devel/py-humanize@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}packaging>=20.9:devel/py-packaging@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}platformdirs>0:devel/py-platformdirs@${PY_FLAVOR}
+TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}Jinja2>=3.1.2:devel/py-Jinja2@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-rerunfailures>0:devel/py-pytest-rerunfailures@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-timeout>0:devel/py-pytest-timeout@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest-xdist>0:devel/py-pytest-xdist@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}pytest>=9:devel/py-pytest@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}setuptools>=0:devel/py-setuptools@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}tomli-w>0:textproc/py-tomli-w@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}validate-pyproject>0:devel/py-validate-pyproject@${PY_FLAVOR} \
+		${PYTHON_PKGNAMEPREFIX}xdoctest>0:devel/py-xdoctest@${PY_FLAVOR}
 
 USES=		python
 USE_PYTHON=	pep517 autoplist pytest
 
 NO_ARCH=	yes
 
+TEST_ENV=	${MAKE_ENV} \
+		PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
+TEST_ARGS=	--disable-plugin-autoload \
+		-p pytest_rerunfailures -p xdoctest
+
 post-patch:
 	@${RM} ${WRKSRC}/*/*.orig ${WRKSRC}/*/*/*.orig ${WRKSRC}/*/*/*/*.orig 2>/dev/null || ${TRUE}
 
+# tests as of 4.2.1: 851 passed, 71 skipped, 3 xfailed in 5.74s (unit_test only)
+
 .include <bsd.port.mk>
diff --git a/devel/py-cibuildwheel/distinfo b/devel/py-cibuildwheel/distinfo
index 617a36a85ec3..d694ca918776 100644
--- a/devel/py-cibuildwheel/distinfo
+++ b/devel/py-cibuildwheel/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1785699168
-SHA256 (cibuildwheel-4.1.1.tar.gz) = 30ee78f134a8273b2f128ffb8c84bce577b9352af30e8ecf412cdf71bb3844c2
-SIZE (cibuildwheel-4.1.1.tar.gz) = 454766
+TIMESTAMP = 1789395242
+SHA256 (cibuildwheel-4.2.1.tar.gz) = 6d67f04c0d1277a3b5301ed2ef82b115efd2ac1fe58b998bbc6ba1d59c918983
+SIZE (cibuildwheel-4.2.1.tar.gz) = 456807
diff --git a/devel/py-cibuildwheel/files/patch-cibuildwheel_architecture.py b/devel/py-cibuildwheel/files/patch-cibuildwheel_architecture.py
index fe7bd19d3ac7..c13515ebe77e 100644
--- a/devel/py-cibuildwheel/files/patch-cibuildwheel_architecture.py
+++ b/devel/py-cibuildwheel/files/patch-cibuildwheel_architecture.py
@@ -1,15 +1,73 @@
---- cibuildwheel/architecture.py.orig	2025-03-31 08:32:45 UTC
+-- Extend the minimal FreeBSD support so the unit tests can run on amd64.
+-- Normalize the FreeBSD machine name "amd64" to "x86_64", include "freebsd"
+-- in architecture tables/synonyms, and handle it in the 32-bit auto-arch path.
+-- The host-platform detection for FreeBSD was already present in this file.
+
+--- cibuildwheel/architecture.py.orig	2026-09-14 15:11:41 UTC
 +++ cibuildwheel/architecture.py
-@@ -87,7 +87,11 @@ class Architecture(Enum):
-         host_platform: PlatformName = (
-             "windows"
-             if sys.platform.startswith("win")
--            else ("macos" if sys.platform.startswith("darwin") else "linux")
-+            else (
-+                "macos" if sys.platform.startswith("darwin") else (
-+                    "freebsd" if sys.platform.startswith("freebsd") else "linux"
-+                )
-+             )
-         )
- 
+@@ -26,12 +26,13 @@ PRETTY_NAMES: Final[dict[PlatformName, str]] = {
+     "pyodide": "Pyodide",
+     "android": "Android",
+     "ios": "iOS",
++    "freebsd": "FreeBSD",
+ }
+
+ ARCH_SYNONYMS: Final[list[dict[PlatformName, str | None]]] = [
+-    {"linux": "x86_64", "macos": "x86_64", "windows": "AMD64", "android": "x86_64"},
+-    {"linux": "i686", "macos": None, "windows": "x86"},
+-    {"linux": "aarch64", "macos": "arm64", "windows": "ARM64", "android": "arm64_v8a"},
++    {"linux": "x86_64", "macos": "x86_64", "windows": "AMD64", "android": "x86_64", "freebsd": "x86_64"},
++    {"linux": "i686", "macos": None, "windows": "x86", "freebsd": None},
++    {"linux": "aarch64", "macos": "arm64", "windows": "ARM64", "android": "arm64_v8a", "freebsd": "aarch64"},
+ ]
+
+
+@@ -133,6 +134,11 @@ class Architecture(StrEnum):
+     @classmethod
+     def native_arch(cls, platform: PlatformName) -> Self | None:
          native_machine = platform_module.machine()
++
++        # FreeBSD reports amd64 instead of x86_64; normalize so the enum lookup works.
++        if sys.platform.startswith("freebsd") and native_machine == "amd64":
++            native_machine = "x86_64"
++
+         native_architecture = cls(native_machine)
+
+         # Cross-platform support. Used for --print-build-identifiers or docker builds.
+@@ -189,16 +195,18 @@ class Architecture(StrEnum):
+
+     @classmethod
+     def all_archs(cls, platform: PlatformName) -> set[Self]:
++        linux_archs = {
++            cls.x86_64,
++            cls.i686,
++            cls.aarch64,
++            cls.ppc64le,
++            cls.s390x,
++            cls.armv7l,
++            cls.riscv64,
++        }
+         all_archs_map = {
+-            "linux": {
+-                cls.x86_64,
+-                cls.i686,
+-                cls.aarch64,
+-                cls.ppc64le,
+-                cls.s390x,
+-                cls.armv7l,
+-                cls.riscv64,
+-            },
++            "linux": linux_archs,
++            "freebsd": linux_archs,
+             "macos": {cls.x86_64, cls.arm64, cls.universal2},
+             "windows": {cls.x86, cls.AMD64, cls.ARM64},
+             "pyodide": {cls.wasm32},
+@@ -233,7 +241,7 @@ class Architecture(StrEnum):
+             case "32":
+                 if native_arch in archs_map.values():
+                     return {native_arch}
+-                elif native_arch in archs_map and platform in {"linux", "windows"}:
++                elif native_arch in archs_map and platform in {"linux", "freebsd", "windows"}:
+                     if native_arch == cls.aarch64 and not _check_aarch32_el0():
+                         # If we're on aarch64, skip if we cannot build armv7l wheels.
+                         return set()
diff --git a/devel/py-cibuildwheel/files/patch-cibuildwheel_platforms_____init____.py b/devel/py-cibuildwheel/files/patch-cibuildwheel_platforms_____init____.py
new file mode 100644
index 000000000000..bfb10924aa6a
--- /dev/null
+++ b/devel/py-cibuildwheel/files/patch-cibuildwheel_platforms_____init____.py
@@ -0,0 +1,22 @@
+-- Recognize FreeBSD as a native platform and route it through the Linux
+-- platform module, since cibuildwheel does not ship a dedicated FreeBSD backend.
+-- This is enough for unit tests and --print-build-identifiers usage.
+
+--- cibuildwheel/platforms/__init__.py.orig	2026-09-14 15:11:41 UTC
++++ cibuildwheel/platforms/__init__.py
+@@ -37,12 +37,15 @@ ALL_PLATFORM_MODULES: Final[dict[PlatformName, Platfor
+     "pyodide": pyodide,
+     "android": android,
+     "ios": ios,
++    "freebsd": linux,
+ }
+
+
+ def native_platform() -> PlatformName:
+     if sys.platform.startswith("linux"):
+         return "linux"
++    elif sys.platform.startswith("freebsd"):
++        return "freebsd"
+     elif sys.platform == "darwin":
+         return "macos"
+     elif sys.platform == "win32":
diff --git a/devel/py-cibuildwheel/files/patch-cibuildwheel_typing.py b/devel/py-cibuildwheel/files/patch-cibuildwheel_typing.py
new file mode 100644
index 000000000000..6c48fa862763
--- /dev/null
+++ b/devel/py-cibuildwheel/files/patch-cibuildwheel_typing.py
@@ -0,0 +1,14 @@
+-- Add "freebsd" to the PlatformName literal so the newly introduced FreeBSD
+-- platform handling is consistent with the rest of the type annotations.
+
+--- cibuildwheel/typing.py.orig	2026-09-14 15:11:41 UTC
++++ cibuildwheel/typing.py
+@@ -12,7 +12,7 @@ PathOrStr = str | os.PathLike[str]
+ PathOrStr = str | os.PathLike[str]
+
+
+-PlatformName = Literal["linux", "macos", "windows", "pyodide", "android", "ios"]
++PlatformName = Literal["linux", "macos", "windows", "pyodide", "android", "ios", "freebsd"]
+ PLATFORMS: Final[frozenset[PlatformName]] = frozenset(typing.get_args(PlatformName))
+
+
diff --git a/devel/py-cibuildwheel/files/patch-pyproject.toml b/devel/py-cibuildwheel/files/patch-pyproject.toml
new file mode 100644
index 000000000000..704e8c9ab0dc
--- /dev/null
+++ b/devel/py-cibuildwheel/files/patch-pyproject.toml
@@ -0,0 +1,16 @@
+-- Restrict tests to the unit_test directory and remove the pytest-rerunfailures
+-- required_plugins check, which conflicts with --disable-plugin-autoload used
+-- in the ports test runner.  The integration tests in test/ require Linux/macOS/
+-- Windows CI infrastructure and cannot run on FreeBSD.
+
+--- pyproject.toml.orig	2026-09-14 15:11:41 UTC
++++ pyproject.toml
+@@ -105,7 +105,7 @@ markers = [
+     "android: tests that run on Android",
+     "pyodide: tests that run on Pyodide",
+ ]
+-required_plugins = ["pytest-rerunfailures"]
++testpaths = ["unit_test"]
+
+ [tool.mypy]
+ python_version = "3.11"
diff --git a/devel/py-cibuildwheel/files/patch-unit__test_main__tests_main__platform__test.py b/devel/py-cibuildwheel/files/patch-unit__test_main__tests_main__platform__test.py
index 2ad9c8d10034..0a14b7c3a3a1 100644
--- a/devel/py-cibuildwheel/files/patch-unit__test_main__tests_main__platform__test.py
+++ b/devel/py-cibuildwheel/files/patch-unit__test_main__tests_main__platform__test.py
@@ -1,4 +1,8 @@
---- unit_test/main_tests/main_platform_test.py.orig	2026-08-02 12:34:41.302162000 -0700
+-- Teach the unit tests that cibuildwheel detects FreeBSD as a platform and
+-- that the native amd64 architecture maps to x86_64 (not the Windows-only
+-- AMD64 enum member).
+
+--- unit_test/main_tests/main_platform_test.py.orig	2026-09-14 15:11:41 UTC
 +++ unit_test/main_tests/main_platform_test.py
 @@ -35,6 +35,8 @@ def test_platform_unset_or_auto(
      # check that the platform was auto detected to build for the current system
@@ -10,11 +14,11 @@
          assert options.platform == "macos"
      elif sys.platform == "win32":
 @@ -98,6 +100,8 @@ def test_archs_default(platform: str, intercepted_build_args: ArgsInterceptor)
- 
+
      if platform == "linux":
          assert options.globals.architectures == {Architecture.x86_64}
 +    elif platform == "freebsd":
-+        assert options.globals.architectures == {Architecture.AMD64}
++        assert options.globals.architectures == {Architecture.x86_64}
      elif platform == "windows":
          assert options.globals.architectures == {Architecture.AMD64, Architecture.x86}
      else:
diff --git a/devel/py-cibuildwheel/files/patch-unit__test_validate__schema__test.py b/devel/py-cibuildwheel/files/patch-unit__test_validate__schema__test.py
new file mode 100644
index 000000000000..7f414039a353
--- /dev/null
+++ b/devel/py-cibuildwheel/files/patch-unit__test_validate__schema__test.py
@@ -0,0 +1,31 @@
+-- Use cibuildwheel's own bundled schema in the validate-pyproject tests.
+-- The schema bundled in validate-pyproject-schema-store is older than
+-- cibuildwheel 4.2.1 and rejects new options such as [tool.cibuildwheel].enable
+-- and the pyodide build-frontend table.
+
+--- unit_test/validate_schema_test.py.orig	2026-09-14 15:11:41 UTC
++++ unit_test/validate_schema_test.py
+@@ -4,7 +4,9 @@ import validate_pyproject.api
+
+ import pytest
+ import validate_pyproject.api
++from validate_pyproject.plugins import PluginWrapper
+
++from cibuildwheel import schema
+ from cibuildwheel.util import resources
+
+ DIR = Path(__file__).parent.resolve()
+@@ -14,8 +16,12 @@ def validator() -> validate_pyproject.api.Validator:
+ def validator() -> validate_pyproject.api.Validator:
+     """
+     Reuse the validator for all tests, to keep unit tests fast.
++    Use only cibuildwheel's own schema, avoiding outdated copies bundled in
++    validate-pyproject-schema-store.
+     """
+-    return validate_pyproject.api.Validator()
++    return validate_pyproject.api.Validator(
++        plugins=[PluginWrapper("cibuildwheel", schema.get_schema)]
++    )
+
+
+ def test_validate_default_schema(validator: validate_pyproject.api.Validator) -> None: