diff --git a/devel/py-pybase64/Makefile b/devel/py-pybase64/Makefile index da50aa480c04..eca870181929 100644 --- a/devel/py-pybase64/Makefile +++ b/devel/py-pybase64/Makefile @@ -1,25 +1,28 @@ PORTNAME= pybase64 -DISTVERSION= 1.4.3 +DISTVERSION= 1.5.0 CATEGORIES= devel python MASTER_SITES= PYPI PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= yuri@FreeBSD.org COMMENT= Fast Base64 encoding/decoding using libbase64 WWW= https://github.com/mayeut/pybase64 LICENSE= BSD2CLAUSE LICENSE_FILE= ${WRKSRC}/LICENSE -BUILD_DEPENDS= ${PY_SETUPTOOLS} \ - ${PYTHON_PKGNAMEPREFIX}setuptools-scm>=8.0:devel/py-setuptools-scm@${PY_FLAVOR} \ +BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools>=63:devel/py-setuptools@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}wheel>0:devel/py-wheel@${PY_FLAVOR} -LIB_DEPENDS= libbase64.so:devel/base64 +TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}packaging>0:devel/py-packaging@${PY_FLAVOR} \ + ${PYTHON_PKGNAMEPREFIX}typing-extensions>=4.6:devel/py-typing-extensions@${PY_FLAVOR} USES= python -USE_PYTHON= autoplist cython pep517 pytest +USE_PYTHON= autoplist pep517 pytest -TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR} -TEST_WRKSRC= ${WRKSRC}/tests +TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}:${WRKSRC}/src +TEST_WRKSRC= ${WRKSRC} +TEST_ARGS= --disable-plugin-autoload + +# tests as of 1.5.0: 22074 passed, 58 skipped .include diff --git a/devel/py-pybase64/distinfo b/devel/py-pybase64/distinfo index 8a2638c48554..a6fd940b9d22 100644 --- a/devel/py-pybase64/distinfo +++ b/devel/py-pybase64/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1775500352 -SHA256 (pybase64-1.4.3.tar.gz) = c2ed274c9e0ba9c8f9c4083cfe265e66dd679126cd9c2027965d807352f3f053 -SIZE (pybase64-1.4.3.tar.gz) = 137272 +TIMESTAMP = 1789396023 +SHA256 (pybase64-1.5.0.tar.gz) = 545ab2a433769e3b8e1ce2b4f7b07218bbde202f4954fbfe52948b2522120727 +SIZE (pybase64-1.5.0.tar.gz) = 149492 diff --git a/devel/py-pybase64/files/patch-pyproject.toml b/devel/py-pybase64/files/patch-pyproject.toml new file mode 100644 index 000000000000..7e6066204979 --- /dev/null +++ b/devel/py-pybase64/files/patch-pyproject.toml @@ -0,0 +1,35 @@ +-- Lower the setuptools lower bound to match the version available in the +-- FreeBSD ports tree (devel/py-setuptools currently provides 63.1.0). +-- Upstream pins >=77, but the port policy is to use the tree's setuptools. +-- Also switch PEP 621 `license` to the {text=...} form and drop +-- `license-files` so the in-tree setuptools can read the metadata. + +--- pyproject.toml.orig 2026-09-14 14:28:19 UTC ++++ pyproject.toml +@@ -1,5 +1,5 @@ + [build-system] +-requires = ["setuptools>=77"] ++requires = ["setuptools>=63"] + build-backend = "setuptools.build_meta" + + [project] +@@ -11,8 +11,8 @@ keywords = ["base64"] + readme = "README.rst" + requires-python = ">=3.9" + keywords = ["base64"] +-license = "BSD-2-Clause" +-license-files = ["LICENSE", "base64/LICENSE"] ++license = {text = "BSD-2-Clause"} ++# license-files = ["LICENSE", "base64/LICENSE"] + classifiers = [ + "Development Status :: 5 - Production/Stable", + # Indicate who your project is intended for +@@ -80,7 +80,7 @@ nox = ["nox>=2025.11.12"] + ] + lint = ["prek"] + nox = ["nox>=2025.11.12"] +-build-system = ["setuptools>=77"] ++build-system = ["setuptools>=63"] + dev = [ + {include-group = "coverage"}, + {include-group = "docs"}, diff --git a/devel/py-pybase64/files/patch-setup.py b/devel/py-pybase64/files/patch-setup.py new file mode 100644 index 000000000000..16fb2bb1e713 --- /dev/null +++ b/devel/py-pybase64/files/patch-setup.py @@ -0,0 +1,16 @@ +-- Link the bundled libbase64 static archive by full path instead of using +-- -lbase64, so the linker does not prefer the shared libbase64.so from +-- /usr/local/lib and leave internal table symbols unresolved. + +--- setup.py.orig 2026-09-14 14:33:07 UTC ++++ setup.py +@@ -46,8 +46,7 @@ pybase64_ext = Extension( + "src/pybase64/_pybase64_get_simd_flags.c", + ], + include_dirs=["base64/include/", "base64/lib/", ".base64_build"], +- library_dirs=[".base64_build"], +- libraries=["base64"], ++ extra_objects=[str(HERE / ".base64_build" / "libbase64.a")], + define_macros=[("BASE64_STATIC_DEFINE", "1")], + optional=OPTIONAL_EXTENSION, + ) diff --git a/devel/py-pybase64/files/patch-tests_conftest.py b/devel/py-pybase64/files/patch-tests_conftest.py new file mode 100644 index 000000000000..cb30ac52bb60 --- /dev/null +++ b/devel/py-pybase64/files/patch-tests_conftest.py @@ -0,0 +1,26 @@ +--- tests/conftest.py.orig 2026-09-14 14:33:46 UTC ++++ tests/conftest.py +@@ -0,0 +1,23 @@ ++from __future__ import annotations ++ ++import pytest ++ ++from . import utils ++ ++simd = utils.simd ++ ++ ++@pytest.fixture(autouse=True) ++def _autoskip_benchmark(request: pytest.FixtureRequest) -> None: ++ marker = request.node.get_closest_marker("benchmark") ++ running = request.config.getoption("--codspeed", default=False) ++ if marker is not None and not running: ++ pytest.skip("needs '--codspeed' to run") ++ ++ ++@pytest.fixture(autouse=True) ++def _autoskip_pypi_distribution(request: pytest.FixtureRequest) -> None: ++ marker = request.node.get_closest_marker("pypi_distribution") ++ running = request.config.getoption("--pypi-distribution", default=False) ++ if marker is not None and not running: ++ pytest.skip("needs '--pypi-distribution' to run") diff --git a/devel/py-pybase64/files/patch-tests_test__packaging.py b/devel/py-pybase64/files/patch-tests_test__packaging.py new file mode 100644 index 000000000000..bad0b003611f --- /dev/null +++ b/devel/py-pybase64/files/patch-tests_test__packaging.py @@ -0,0 +1,16 @@ +-- The in-tree setuptools version does not emit PEP 639 License-Expression; +-- fall back to the classic License field so the test passes with the +-- FreeBSD ports tree's setuptools. + +--- tests/test_packaging.py.orig 2026-09-14 14:33:42 UTC ++++ tests/test_packaging.py +@@ -18,7 +18,8 @@ def test_license() -> None: + + def test_license() -> None: + metadata = importlib.metadata.metadata("pybase64") +- assert metadata["License-Expression"] == "BSD-2-Clause" ++ license_expression = metadata.get("License-Expression") ++ assert license_expression == "BSD-2-Clause" or metadata["License"].startswith("BSD-2-Clause") + + + @pytest.mark.pypi_distribution diff --git a/devel/py-pybase64/files/patch-tests_utils.py b/devel/py-pybase64/files/patch-tests_utils.py new file mode 100644 index 000000000000..87bd90667a6b --- /dev/null +++ b/devel/py-pybase64/files/patch-tests_utils.py @@ -0,0 +1,76 @@ +-- Add missing test support files that upstream left out of the PyPI sdist. +-- tests/__init__.py lets the test modules use relative imports, and +-- tests/utils.py provides the param_simd fixture/helpers they import. +-- See https://github.com/mayeut/pybase64/tree/v1.5.0/tests + +--- tests/__init__.py.orig 2026-09-14 14:34:28 UTC ++++ tests/__init__.py +@@ -0,0 +1 @@ ++# placeholder to allow relative imports in the test suite +--- tests/utils.py.orig 2026-09-14 14:34:28 UTC ++++ tests/utils.py +@@ -0,0 +1,64 @@ ++from __future__ import annotations ++ ++import os ++ ++import pytest ++ ++import pybase64 ++ ++TYPE_CHECKING = False ++if TYPE_CHECKING: ++ from collections.abc import Iterator ++ from typing import Any ++ ++has_extension = hasattr(pybase64, "_set_simd_path") ++assert has_extension or os.environ.get("CIBUILDWHEEL", "0") == "0" ++ ++compile_flags = [0] ++runtime_flags = 0 ++if has_extension: ++ runtime_flags = pybase64._get_simd_flags_runtime() # type: ignore[attr-defined] ++ flags = pybase64._get_simd_flags_compile() # type: ignore[attr-defined] ++ for i in range(31): ++ if flags & (1 << i): ++ compile_flags += [(1 << i)] ++ ++ ++def _get_simd_name(simd_id: int) -> str: ++ if has_extension: ++ simd_flag = compile_flags[simd_id] ++ simd_name = "C" if simd_flag == 0 else pybase64._get_simd_name(simd_flag) # type: ignore[attr-defined] ++ else: ++ simd_name = "PY" ++ return simd_name ++ ++ ++param_simd = pytest.mark.parametrize( ++ "simd", ++ range(len(compile_flags)), ++ ids=_get_simd_name, ++ indirect=True, ++) ++ ++ ++@pytest.fixture ++def simd(request: pytest.FixtureRequest) -> Iterator[int]: ++ simd_id = request.param ++ if not has_extension: ++ assert simd_id == 0 ++ yield simd_id ++ return ++ ++ flag = compile_flags[simd_id] ++ if flag != 0 and not flag & runtime_flags: # pragma: no branch ++ simd_name = _get_simd_name(simd_id) # pragma: no cover ++ pytest.skip(f"{simd_name!r} SIMD extension not available") # pragma: no cover ++ old_flag = pybase64._get_simd_path() # type: ignore[attr-defined] ++ pybase64._set_simd_path(flag) # type: ignore[attr-defined] ++ assert pybase64._get_simd_path() == flag # type: ignore[attr-defined] ++ yield simd_id ++ pybase64._set_simd_path(old_flag) # type: ignore[attr-defined] ++ ++ ++def unused_args(*args: Any) -> None: # noqa: ARG001 ++ return None