Re: git: 96719dff8ae4 - main - devel/brz: Fix with cython 3, undeprecate

From: Rene Ladan <rene_at_freebsd.org>
Date: Tue, 15 Sep 2026 20:48:22 UTC
On Sun, Sep 06, 2026 at 10:20:51PM +0000, Vladimir Druzenko wrote:
> The branch main has been updated by vvd:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=96719dff8ae4dd6126df245ba36804f2e739fc54
> 
> commit 96719dff8ae4dd6126df245ba36804f2e739fc54
> Author:     Matthew D. Fuller <fullermd@over-yonder.net>
> AuthorDate: 2026-09-06 22:19:35 +0000
> Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
> CommitDate: 2026-09-06 22:19:35 +0000
> 
>     devel/brz: Fix with cython 3, undeprecate
>     
This only partially solves the problem, because devel/py-fastbencode still relies on cython0.

Kind regards,
René

>     PR:             298249
>     Sponsored by:   UNIS Labs
>     MFH:            2026Q3
> ---
>  devel/brz/Makefile                                 |  7 ++--
>  .../brz/files/patch-breezy_bzr___chk__map__pyx.pyx | 31 ++++++++++++++++++
>  .../patch-breezy_bzr___dirstate__helpers__pyx.pyx  | 38 ++++++++++++++++++++++
>  3 files changed, 71 insertions(+), 5 deletions(-)
> 
> diff --git a/devel/brz/Makefile b/devel/brz/Makefile
> index 3b4bd31aff42..07f4af128868 100644
> --- a/devel/brz/Makefile
> +++ b/devel/brz/Makefile
> @@ -1,6 +1,6 @@
>  PORTNAME=	brz
>  DISTVERSION=	3.2.2
> -PORTREVISION=	4
> +PORTREVISION=	5
>  CATEGORIES=	devel
>  MASTER_SITES=	PYPI
>  PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
> @@ -13,9 +13,6 @@ WWW=		https://www.breezy-vcs.org/
>  LICENSE=	GPLv2+
>  LICENSE_FILE=	${WRKSRC}/COPYING.txt
>  
> -DEPRECATED=	Depends on expired lang/cython0
> -EXPIRATION_DATE=2026-09-15
> -
>  BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}configobj>=0:devel/py-configobj@${PY_FLAVOR}
>  RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}configobj>=0:devel/py-configobj@${PY_FLAVOR} \
>  		${PYTHON_PKGNAMEPREFIX}fastbencode>=0:devel/py-fastbencode@${PY_FLAVOR} \
> @@ -25,7 +22,7 @@ RUN_DEPENDS=	${PYTHON_PKGNAMEPREFIX}configobj>=0:devel/py-configobj@${PY_FLAVOR}
>  TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}testtools>=0:devel/py-testtools@${PY_FLAVOR}
>  
>  USES=		gettext-tools python shebangfix
> -USE_PYTHON=	autoplist concurrent cython0 distutils
> +USE_PYTHON=	autoplist concurrent cython distutils
>  
>  SHEBANG_FILES=	brz
>  MAKE_ENV=	BRZ_LOG=/dev/null
> diff --git a/devel/brz/files/patch-breezy_bzr___chk__map__pyx.pyx b/devel/brz/files/patch-breezy_bzr___chk__map__pyx.pyx
> new file mode 100644
> index 000000000000..6e9d28a7fb52
> --- /dev/null
> +++ b/devel/brz/files/patch-breezy_bzr___chk__map__pyx.pyx
> @@ -0,0 +1,31 @@
> +--- breezy/bzr/_chk_map_pyx.pyx.orig	2026-09-06 21:14:33 UTC
> ++++ breezy/bzr/_chk_map_pyx.pyx
> +@@ -40,8 +40,8 @@ from cpython.dict cimport (
> + from cpython.dict cimport (
> +     PyDict_SetItem,
> +     )
> +-from cpython.int cimport (
> +-    PyInt_AsUnsignedLongMask,
> ++from cpython.long cimport (
> ++    PyLong_AsUnsignedLongMask,
> +     )
> + from cpython.object cimport (
> +     PyObject,
> +@@ -102,7 +102,7 @@ def _search_key_16(key):
> +         if i > 0:
> +             c_out[0] = c'\x00'
> +             c_out = c_out + 1
> +-        crc_val = PyInt_AsUnsignedLongMask(crc32(key[i])) & 0xFFFFFFFFUL
> ++        crc_val = PyLong_AsUnsignedLongMask(crc32(key[i])) & 0xFFFFFFFFUL
> +         # Hex(val) order
> +         sprintf(c_out, '%08lX', crc_val)
> +         c_out = c_out + 8
> +@@ -127,7 +127,7 @@ def _search_key_255(key):
> +         if i > 0:
> +             c_out[0] = c'\x00'
> +             c_out = c_out + 1
> +-        crc_val = PyInt_AsUnsignedLongMask(crc32(key[i]))
> ++        crc_val = PyLong_AsUnsignedLongMask(crc32(key[i]))
> +         # MSB order
> +         c_out[0] = (crc_val >> 24) & 0xFF
> +         c_out[1] = (crc_val >> 16) & 0xFF
> diff --git a/devel/brz/files/patch-breezy_bzr___dirstate__helpers__pyx.pyx b/devel/brz/files/patch-breezy_bzr___dirstate__helpers__pyx.pyx
> new file mode 100644
> index 000000000000..18e25e4472e6
> --- /dev/null
> +++ b/devel/brz/files/patch-breezy_bzr___dirstate__helpers__pyx.pyx
> @@ -0,0 +1,38 @@
> +--- breezy/bzr/_dirstate_helpers_pyx.pyx.orig	2026-09-06 21:17:46 UTC
> ++++ breezy/bzr/_dirstate_helpers_pyx.pyx
> +@@ -98,7 +98,7 @@ cdef extern from "Python.h":
> +     object PyTuple_GetItem_void_object "PyTuple_GET_ITEM" (void* tpl, int index)
> +     object PyTuple_GET_ITEM(object tpl, Py_ssize_t index)
> + 
> +-    unsigned long PyInt_AsUnsignedLongMask(object number) except? -1
> ++    unsigned long PyLong_AsUnsignedLongMask(object number) except? -1
> + 
> +     char *PyBytes_AsString(object p)
> +     char *PyBytes_AsString_obj "PyBytes_AsString" (PyObject *string)
> +@@ -800,7 +800,7 @@ cdef unsigned long _time_to_unsigned(object t):  # can
> + cdef unsigned long _time_to_unsigned(object t):  # cannot_raise
> +     if PyFloat_Check(t):
> +         t = t.__int__()
> +-    return PyInt_AsUnsignedLongMask(t)
> ++    return PyLong_AsUnsignedLongMask(t)
> + 
> + 
> + cdef _pack_stat(stat_value):
> +@@ -812,13 +812,13 @@ cdef _pack_stat(stat_value):
> +     cdef char result[6*4] # 6 long ints
> +     cdef int *aliased
> +     aliased = <int *>result
> +-    aliased[0] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_size))
> ++    aliased[0] = htonl(PyLong_AsUnsignedLongMask(stat_value.st_size))
> +     # mtime and ctime will often be floats but get converted to PyInt within
> +     aliased[1] = htonl(_time_to_unsigned(stat_value.st_mtime))
> +     aliased[2] = htonl(_time_to_unsigned(stat_value.st_ctime))
> +-    aliased[3] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_dev))
> +-    aliased[4] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_ino))
> +-    aliased[5] = htonl(PyInt_AsUnsignedLongMask(stat_value.st_mode))
> ++    aliased[3] = htonl(PyLong_AsUnsignedLongMask(stat_value.st_dev))
> ++    aliased[4] = htonl(PyLong_AsUnsignedLongMask(stat_value.st_ino))
> ++    aliased[5] = htonl(PyLong_AsUnsignedLongMask(stat_value.st_mode))
> +     packed = PyBytes_FromStringAndSize(result, 6*4)
> +     return _encode(packed)[:-1]
> +