git: 74591871ed6e - main - science/py-libgetar: Fix build with numpy-2.x

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 07 Jul 2026 02:36:07 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=74591871ed6ef7db0a378af66c7968247e3c8e93

commit 74591871ed6ef7db0a378af66c7968247e3c8e93
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-07-07 02:32:13 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-07-07 02:36:03 +0000

    science/py-libgetar: Fix build with numpy-2.x
    
    Reported by:    fallout
---
 science/py-libgetar/Makefile                    |  4 +++-
 science/py-libgetar/files/patch-gtar___gtar.pyx | 14 ++++++++++++++
 science/py-libgetar/files/patch-setup.py        | 23 +++++++++++++++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/science/py-libgetar/Makefile b/science/py-libgetar/Makefile
index 3893da4c01bf..a271c15c162f 100644
--- a/science/py-libgetar/Makefile
+++ b/science/py-libgetar/Makefile
@@ -12,7 +12,7 @@ WWW=		https://github.com/glotzerlab/libgetar
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-PY_DEPENDS=	${PYTHON_PKGNAMEPREFIX}numpy1>=1.16:math/py-numpy1@${PY_FLAVOR} \
+PY_DEPENDS=	${PYTHON_PKGNAMEPREFIX}numpy>0:math/py-numpy@${PY_FLAVOR} \
 		${PYTHON_PKGNAMEPREFIX}breathe>0:devel/py-breathe@${PY_FLAVOR}
 BUILD_DEPENDS=	${PY_DEPENDS}
 RUN_DEPENDS=	${PY_DEPENDS}
@@ -31,4 +31,6 @@ post-install:
 do-test:
 	@cd ${WRKSRC}/test && ${SETENV} ${TEST_ENV} ${PYTHON_CMD} -m unittest discover
 
+# tests as of 1.1.7: Ran 28 tests in 0.065s, OK (skipped=1)
+
 .include <bsd.port.mk>
diff --git a/science/py-libgetar/files/patch-gtar___gtar.pyx b/science/py-libgetar/files/patch-gtar___gtar.pyx
new file mode 100644
index 000000000000..fe7e74ae89ea
--- /dev/null
+++ b/science/py-libgetar/files/patch-gtar___gtar.pyx
@@ -0,0 +1,14 @@
+-- Fix relative import of local cpp.pxd in Cython 3 to avoid shadowing issues
+--- gtar/_gtar.pyx.orig	2026-07-07 02:28:54 UTC
++++ gtar/_gtar.pyx
+@@ -8,8 +8,8 @@ from cpython cimport PyObject, Py_INCREF
+ cimport numpy as np
+ from cpython cimport PyObject, Py_INCREF
+ 
+-cimport cpp
+-from cpp cimport GTAR as GTAR_
++from . cimport cpp
++from .cpp cimport GTAR as GTAR_
+ 
+ np.import_array()
+ 
diff --git a/science/py-libgetar/files/patch-setup.py b/science/py-libgetar/files/patch-setup.py
new file mode 100644
index 000000000000..4b95694c53da
--- /dev/null
+++ b/science/py-libgetar/files/patch-setup.py
@@ -0,0 +1,23 @@
+-- Make Cython build automatic if it is present in the environment
+-- This allows the ports build to re-generate C++ sources using modern Cython
+--- setup.py.orig	2026-07-07 02:28:03 UTC
++++ setup.py
+@@ -62,10 +62,17 @@ if '--debug' in sys.argv:
+     extra_args.extend(['-O0', '-g'])
+     sys.argv.remove('--debug')
+ 
+-if '--cython' in sys.argv:
++try:
+     from Cython.Build import cythonize
++    has_cython = True
++except ImportError:
++    has_cython = False
++
++if '--cython' in sys.argv:
++    has_cython = True
+     sys.argv.remove('--cython')
+ 
++if has_cython:
+     def myCythonize(macros, *args, **kwargs):
+         result = cythonize(*args, **kwargs)
+         for r in result: