pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-numpy: hack around NetBSD libm problem



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%gatalith.at@localhost>
Pushed By:	wiz
Date:		Mon Mar 13 19:48:58 2023 +0100
Changeset:	fe55cfd67b8de0d9b41e9005cbfc5a1582c31c90

Modified Files:
	py-numpy/Makefile
	py-numpy/PLIST
	py-numpy/buildlink3.mk
	py-numpy/distinfo
	py-numpy/log
Added Files:
	py-numpy/make_env.mk
	py-numpy/patches/patch-numpy_core_src_common_mem__overlap.c
	py-numpy/patches/patch-numpy_linalg_umath__linalg.cpp
Removed Files:
	py-numpy/Makefile.make_env
	py-numpy/TODO

Log Message:
py-numpy: hack around NetBSD libm problem

Some minor cleanups while here.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=fe55cfd67b8de0d9b41e9005cbfc5a1582c31c90

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-numpy/Makefile                                  | 11 +------
 py-numpy/Makefile.make_env                         | 10 ------
 py-numpy/PLIST                                     |  1 -
 py-numpy/TODO                                      |  1 -
 py-numpy/buildlink3.mk                             |  2 +-
 py-numpy/distinfo                                  |  2 ++
 py-numpy/log                                       | 38 ++++++++++++++++++++++
 py-numpy/make_env.mk                               | 10 ++++++
 .../patch-numpy_core_src_common_mem__overlap.c     | 24 ++++++++++++++
 .../patches/patch-numpy_linalg_umath__linalg.cpp   | 23 +++++++++++++
 10 files changed, 99 insertions(+), 23 deletions(-)

diffs:
diff --git a/py-numpy/Makefile b/py-numpy/Makefile
index 2141e2535a..37a4d0c8fa 100644
--- a/py-numpy/Makefile
+++ b/py-numpy/Makefile
@@ -25,8 +25,6 @@ REPLACE_PYTHON+=	*.py */*.py */*/*.py */*/*/*.py */*/*/*/*.py
 
 PYTHON_VERSIONS_INCOMPATIBLE=	27 37
 
-USE_PKG_RESOURCES=	yes
-
 # XXX Avoid picking up other compilers when installed
 .include "../../mk/compiler.mk"
 
@@ -46,20 +44,13 @@ BLAS_ACCEPTED=		${_BLAS_TYPES} accelerate.framework
 BLAS_C_INTERFACE=	yes
 CPPFLAGS+=		${BLAS_INCLUDES}
 
-# doesn't work because math.h contains both log2 and log2l
-# CPPFLAGS.NetBSD+=	-Dlog2l=log2
-
-.include "../../mk/bsd.prefs.mk"
-
 # Remove invalid __STDC_VERSION__ setting
 BUILDLINK_TRANSFORM.SunOS+=	rm:-D__STDC_VERSION__=0
 
-pre-install:
-	${RM} -f ${WRKSRC}/numpy/core/include/numpy/npy_common.h.orig
-
 post-install:
 	cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py || ${TRUE}
 	cd ${DESTDIR}${PREFIX}/bin && ${RM} f2py3 || ${TRUE}
+	${RM} ${DESTDIR}${PREFIX}/${PYSITELIB}/numpy/core/include/numpy/npy_common.h.orig
 
 do-test:
 	cd ${WRKDIR} && \
diff --git a/py-numpy/Makefile.make_env b/py-numpy/Makefile.make_env
deleted file mode 100644
index 91a53fd91e..0000000000
--- a/py-numpy/Makefile.make_env
+++ /dev/null
@@ -1,10 +0,0 @@
-# $NetBSD: Makefile.make_env,v 1.4 2021/06/15 04:41:53 thor Exp $
-# Use the variables from blas.buildlink3.mk, pulled in via cblas.
-# Dependent Python packages possibly re-use the system_info logic and
-# might need this in the environment.
-.if ${BLAS_TYPE:U} == "accelerate.framework"
-MAKE_ENV+=	NPY_BLAS_ORDER=accelerate
-.else
-MAKE_ENV+=	NPY_BLAS_LIBS=${BLAS_LIBS:Q} NPY_LAPACK_LIBS=${LAPACK_LIBS:Q}
-MAKE_ENV+=	NPY_CBLAS_LIBS=${CBLAS_LIBS:Q}
-.endif
diff --git a/py-numpy/PLIST b/py-numpy/PLIST
index c97c1818aa..ea79b0c93f 100644
--- a/py-numpy/PLIST
+++ b/py-numpy/PLIST
@@ -202,7 +202,6 @@ ${PYSITELIB}/numpy/core/include/numpy/noprefix.h
 ${PYSITELIB}/numpy/core/include/numpy/npy_1_7_deprecated_api.h
 ${PYSITELIB}/numpy/core/include/numpy/npy_3kcompat.h
 ${PYSITELIB}/numpy/core/include/numpy/npy_common.h
-${PYSITELIB}/numpy/core/include/numpy/npy_common.h.orig
 ${PYSITELIB}/numpy/core/include/numpy/npy_cpu.h
 ${PYSITELIB}/numpy/core/include/numpy/npy_endian.h
 ${PYSITELIB}/numpy/core/include/numpy/npy_interrupt.h
diff --git a/py-numpy/TODO b/py-numpy/TODO
deleted file mode 100644
index e5f220c4b6..0000000000
--- a/py-numpy/TODO
+++ /dev/null
@@ -1 +0,0 @@
-Fails self-tests on NetBSD due to missing log2l() symbol.
diff --git a/py-numpy/buildlink3.mk b/py-numpy/buildlink3.mk
index 687b97c3e6..480f5fb949 100644
--- a/py-numpy/buildlink3.mk
+++ b/py-numpy/buildlink3.mk
@@ -18,7 +18,7 @@ BUILDLINK_PKGSRCDIR.py-numpy?=		../../math/py-numpy
 
 .include "../../mk/bsd.fast.prefs.mk"
 
-.include "../../math/py-numpy/Makefile.make_env"
+.include "../../wip/py-numpy/make_env.mk"
 
 # Mimick the choice from Makefile. Or better store/load build choice?
 BLAS_ACCEPTED=		${_BLAS_TYPES} accelerate.framework
diff --git a/py-numpy/distinfo b/py-numpy/distinfo
index 36e8ce286e..4a4fb8aa0c 100644
--- a/py-numpy/distinfo
+++ b/py-numpy/distinfo
@@ -5,6 +5,7 @@ SHA512 (numpy-1.24.2.tar.gz) = 145fd7fb3919a185f75076d51b92c54a7fb1b776b637752ca
 Size (numpy-1.24.2.tar.gz) = 10906862 bytes
 SHA1 (patch-numpy_core_include_numpy_npy__common.h) = 354e336b98f634b6298d0b1d0e85ef1a9d240bff
 SHA1 (patch-numpy_core_setup.py) = 01f90b7eb700cfa51edded31498c2de4c3850848
+SHA1 (patch-numpy_core_src_common_mem__overlap.c) = 10d65c7f8ba740ce2bae5ad47ef3162cd2c5a40b
 SHA1 (patch-numpy_core_src_npymath_npy__math__private.h) = e3b8e751fd0b6b6c6794d714aa5f60dfe9d7f421
 SHA1 (patch-numpy_distutils_command_config.py) = eb37d28482689703e0c1a264f9768409cf8bb4b6
 SHA1 (patch-numpy_distutils_fcompiler_____init____.py) = 49d070da5b48bd9818b37ac3254341fa68503c53
@@ -13,3 +14,4 @@ SHA1 (patch-numpy_distutils_fcompiler_gnu.py) = 1ab3fd7b3f42328f4094f1b21a65c05a
 SHA1 (patch-numpy_distutils_log.py) = 4c968b934fb24da096a1f4d2cd4ebb2e3fd92334
 SHA1 (patch-numpy_linalg_lapack__litemodule.c) = e97ec871c2f33c3121b3c8471a9e5a74c3c798c8
 SHA1 (patch-numpy_linalg_setup.py) = 867a2aba13ebb60b67ac2824a4cb1aff2e1231ee
+SHA1 (patch-numpy_linalg_umath__linalg.cpp) = 4e02f3b4f6550653e851b0b6819f7048aac297e6
diff --git a/py-numpy/log b/py-numpy/log
index c21d2e9447..8ee0dc9f1f 100644
--- a/py-numpy/log
+++ b/py-numpy/log
@@ -1,3 +1,9 @@
+1.24.2
+
+NumPy 1.24.2 is a maintenance release that fixes bugs and regressions
+discovered after the 1.24.1 release. The Python versions supported by
+this release are 3.8-3.11.
+
 1.24.1
 
 Bugfix release
@@ -17,3 +23,35 @@ clarify the documentation. There are a large number of new and
 expired deprecations due to changes in dtype promotion and cleanups.
 It is the work of 177 contributors spread over 444 pull requests.
 The supported Python versions are 3.8-3.11.
+
+
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_casting_floatingpoint_errors.py::test_floatingpoint_errors_casting[longdouble-to-f8] - Failed: DID NOT WARN. No warnings of type (<class 'RuntimeWarning'>,) were emitted.
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_getlimits.py::test_known_types - AssertionError:
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_nep50_promotions.py::test_nep50_weak_integers_with_inexact[g] - OverflowError: cannot convert longdouble infinity to integer
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_nep50_promotions.py::test_nep50_weak_integers_with_inexact[G] - OverflowError: cannot convert longdouble infinity to integer
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_numeric.py::TestFloatExceptions::test_floating_exceptions[g] - AssertionError: Type <class 'numpy.ndarray'> did not raise fpe error 'underflow'.
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_numeric.py::TestFloatExceptions::test_floating_exceptions[G] - AssertionError: Type <class 'numpy.complex256'> did not raise fpe error ''.
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data10-escape10-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735181aa5160>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data10-escape10-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351814c2e60>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data10-escape10-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848473e0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data11-escape11-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735184856520>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data11-escape11-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x73518485f6a0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data11-escape11-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735181588260>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data12-escape12-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735184866520>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data12-escape12-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735184871420>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data12-escape12-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x73518487f2a0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data13-escape13-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848872a0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data13-escape13-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735181588260>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data13-escape13-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x735184892da0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data14-escape14-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x73518489bde0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data14-escape14-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848a5de0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data14-escape14-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848899a0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data15-escape15-e-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848c3a60>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data15-escape15-f-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848d6b20>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestSpecialFloats::test_unary_spurious_fpexception[data15-escape15-d-log1p] - AssertionError: Got warnings: [<warnings.WarningMessage object at 0x7351848e1ae0>]
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestAVXUfuncs::test_avx_based_ufunc - AssertionError:
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::TestAVXFloat32Transcendental::test_sincos_float32 - AssertionError: Arrays are not almost equal up to 2 ULP (max difference is 67 ULP)
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/core/tests/test_umath.py::test_nextafter_0 - AssertionError
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/distutils/tests/test_log.py::test_log_prefix[info] - AssertionError: assert ''
+FAILED .destdir/usr/pkg/lib/python3.11/site-packages/numpy/distutils/tests/test_log.py::test_log_prefix[debug] - AssertionError: assert ''
+29 failed, 26625 passed, 1481 skipped, 1307 deselected, 35 xfailed, 2 xpassed, 40 warnings in 237.85s (0:03:57)
diff --git a/py-numpy/make_env.mk b/py-numpy/make_env.mk
new file mode 100644
index 0000000000..91a53fd91e
--- /dev/null
+++ b/py-numpy/make_env.mk
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile.make_env,v 1.4 2021/06/15 04:41:53 thor Exp $
+# Use the variables from blas.buildlink3.mk, pulled in via cblas.
+# Dependent Python packages possibly re-use the system_info logic and
+# might need this in the environment.
+.if ${BLAS_TYPE:U} == "accelerate.framework"
+MAKE_ENV+=	NPY_BLAS_ORDER=accelerate
+.else
+MAKE_ENV+=	NPY_BLAS_LIBS=${BLAS_LIBS:Q} NPY_LAPACK_LIBS=${LAPACK_LIBS:Q}
+MAKE_ENV+=	NPY_CBLAS_LIBS=${CBLAS_LIBS:Q}
+.endif
diff --git a/py-numpy/patches/patch-numpy_core_src_common_mem__overlap.c b/py-numpy/patches/patch-numpy_core_src_common_mem__overlap.c
new file mode 100644
index 0000000000..a53820a9d9
--- /dev/null
+++ b/py-numpy/patches/patch-numpy_core_src_common_mem__overlap.c
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Workaround for https://github.com/numpy/numpy/issues/23379
+
+--- numpy/core/src/common/mem_overlap.c.orig	2023-02-05 17:13:47.573364500 +0000
++++ numpy/core/src/common/mem_overlap.c
+@@ -921,3 +921,17 @@ solve_may_have_internal_overlap(PyArrayO
+     /* Solve */
+     return solve_diophantine(nterms, terms, -1, max_work, 1, x);
+ }
++
++#ifdef __NetBSD__
++/* hack for missing log2l() symbol - see https://github.com/numpy/numpy/issues/23379 */
++/* in this file because it's included by all _multiarray_* so files */
++long double log2l(long double arg) {
++    return log2(arg);
++}
++long double log1pl(long double arg) {
++    return log1p(arg);
++}
++long double expm1l(long double arg) {
++    return expm1(arg);
++}
++#endif
diff --git a/py-numpy/patches/patch-numpy_linalg_umath__linalg.cpp b/py-numpy/patches/patch-numpy_linalg_umath__linalg.cpp
new file mode 100644
index 0000000000..f538b40a9f
--- /dev/null
+++ b/py-numpy/patches/patch-numpy_linalg_umath__linalg.cpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+Workaround for https://github.com/numpy/numpy/issues/23379
+
+--- numpy/linalg/umath_linalg.cpp.orig	2023-02-05 17:13:47.689365400 +0000
++++ numpy/linalg/umath_linalg.cpp
+@@ -4567,3 +4567,16 @@ PyMODINIT_FUNC PyInit__umath_linalg(void
+ 
+     return m;
+ }
++
++#ifdef __NetBSD__
++/* hack for missing log2l() symbol - see https://github.com/numpy/numpy/issues/23379 */
++long double log2l(long double arg) {
++    return log2(arg);
++}
++long double log1pl(long double arg) {
++    return log1p(arg);
++}
++long double expm1l(long double arg) {
++    return expm1(arg);
++}
++#endif


Home | Main Index | Thread Index | Old Index