diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-06-16 09:03:07 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-06-16 09:03:07 +0200 |
commit | 5aa895d9c03be3b5c0d3fa80148d2ab41e79e440 (patch) | |
tree | 91b98e9c9e2b171ee893f801864c561ec2e8deb8 /dev-python/blosc | |
parent | dev-lang/python: Remove obsolete postinst from 3.12+ (diff) | |
download | gentoo-5aa895d9c03be3b5c0d3fa80148d2ab41e79e440.tar.gz gentoo-5aa895d9c03be3b5c0d3fa80148d2ab41e79e440.tar.bz2 gentoo-5aa895d9c03be3b5c0d3fa80148d2ab41e79e440.zip |
dev-python/blosc: Fix test failures with >=dev-python/numpy-2
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/blosc')
-rw-r--r-- | dev-python/blosc/blosc-1.11.1.ebuild | 5 | ||||
-rw-r--r-- | dev-python/blosc/files/blosc-1.11.1-numpy-2.patch | 51 |
2 files changed, 56 insertions, 0 deletions
diff --git a/dev-python/blosc/blosc-1.11.1.ebuild b/dev-python/blosc/blosc-1.11.1.ebuild index a6135a6ca9c4..d61d1db5fca0 100644 --- a/dev-python/blosc/blosc-1.11.1.ebuild +++ b/dev-python/blosc/blosc-1.11.1.ebuild @@ -45,6 +45,11 @@ BDEPEND=" DOCS=( ANNOUNCE.rst README.rst RELEASE_NOTES.rst ) +PATCHES=( + # https://github.com/Blosc/python-blosc/pull/329 + "${FILESDIR}/${P}-numpy-2.patch" +) + src_configure() { export USE_SYSTEM_BLOSC=1 export BLOSC_DIR="${EPREFIX}/usr" diff --git a/dev-python/blosc/files/blosc-1.11.1-numpy-2.patch b/dev-python/blosc/files/blosc-1.11.1-numpy-2.patch new file mode 100644 index 000000000000..97010c0a4bf6 --- /dev/null +++ b/dev-python/blosc/files/blosc-1.11.1-numpy-2.patch @@ -0,0 +1,51 @@ +From 4823cb746023821166756322becd3fc242cd0b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sun, 16 Jun 2024 08:59:36 +0200 +Subject: [PATCH] Fix test failures with NumPy 2 + +* Replace deprecated `np.alltrue()` with `np.all()` (available since + NumPy 1.7.0). + +* Cast NumPy boolean to `bool()`, to ensure doctests pass both with + NumPy 2 (using `np.True_`) and NumPy 1 (using plain `True`). +--- + blosc/toplevel.py | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/blosc/toplevel.py b/blosc/toplevel.py +index ad9c12d..4d2d413 100644 +--- a/blosc/toplevel.py ++++ b/blosc/toplevel.py +@@ -514,7 +514,7 @@ def compress_ptr(address, items, typesize=8, clevel=9, shuffle=blosc.SHUFFLE, + items, np_array.dtype.itemsize) + >>> d = blosc.decompress(c) + >>> np_ans = numpy.fromstring(d, dtype=np_array.dtype) +- >>> (np_array == np_ans).all() ++ >>> bool((np_array == np_ans).all()) + True + + >>> import ctypes +@@ -640,7 +640,7 @@ def decompress_ptr(bytes_like, address): + items, np_array.dtype.itemsize) + >>> np_ans = numpy.empty(items, dtype=np_array.dtype) + >>> nbytes = blosc.decompress_ptr(c, np_ans.__array_interface__['data'][0]) +- >>> (np_array == np_ans).all() ++ >>> bool((np_array == np_ans).all()) + True + >>> nbytes == items * np_array.dtype.itemsize + True +@@ -769,12 +769,12 @@ def unpack_array(packed_array, **kwargs): + >>> len(parray) < a.size*a.itemsize + True + >>> a2 = blosc.unpack_array(parray) +- >>> numpy.alltrue(a == a2) ++ >>> bool(numpy.all(a == a2)) + True + >>> a = numpy.array(['å', 'ç', 'ø']) + >>> parray = blosc.pack_array(a) + >>> a2 = blosc.unpack_array(parray) +- >>> numpy.alltrue(a == a2) ++ >>> bool(numpy.all(a == a2)) + True + """ + |