summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-07-02 08:18:30 +0200
committerMichał Górny <mgorny@gentoo.org>2024-07-02 08:58:49 +0200
commit4010bd0e93aafb73979a5c5fc43510ebb7abb2f4 (patch)
tree51ed22e5855fc0d034cd44b24f7ca3f086dc56a2 /dev-python/mpmath
parentdev-python/gmpy: Bump to 2.2.0 (diff)
downloadgentoo-4010bd0e93aafb73979a5c5fc43510ebb7abb2f4.tar.gz
gentoo-4010bd0e93aafb73979a5c5fc43510ebb7abb2f4.tar.bz2
gentoo-4010bd0e93aafb73979a5c5fc43510ebb7abb2f4.zip
dev-python/mpmath: Bump to 1.4.0_alpha1
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/mpmath')
-rw-r--r--dev-python/mpmath/Manifest1
-rw-r--r--dev-python/mpmath/files/mpmath-1.4.0_alpha1-numpy-2.patch32
-rw-r--r--dev-python/mpmath/mpmath-1.4.0_alpha1.ebuild63
3 files changed, 96 insertions, 0 deletions
diff --git a/dev-python/mpmath/Manifest b/dev-python/mpmath/Manifest
index c856f8ba229c..62f82da139aa 100644
--- a/dev-python/mpmath/Manifest
+++ b/dev-python/mpmath/Manifest
@@ -1 +1,2 @@
DIST mpmath-1.3.0.tar.gz 508106 BLAKE2B 9d4eebbbb6788dd3ee45c8c30068ef3512043dd09ab626cbaf69b0f6bdf057a6e8c53c34e3dda7627db923f0d536a0bebf83916d8942f4dde9546bb8e0046f33 SHA512 a68028150095d743eae9669a0f70cbe6b7bcb4d27dfad6b1a96575f0885ec7306459a2a464117bab18779883ee8b4293502b4bd0ebd8672767e1d08d38f8b202
+DIST mpmath-1.4.0a1.tar.gz 2063946 BLAKE2B 0c6a86b1c8dc9addc3eb82586d4c4182ae6a9318cbe45d4fc699b9fbf9539774ae30f11c2d50137a3aa16ed4b0c328990483c2ceea812f86751cfa3ce419de5c SHA512 260afb20faaa949b89054ced3b039e346086d47c6ea018c8d226a0c42d9aa8f792611fe709c894a0df6930a0703dc8cfcf814432eba7ac977a821effd8879903
diff --git a/dev-python/mpmath/files/mpmath-1.4.0_alpha1-numpy-2.patch b/dev-python/mpmath/files/mpmath-1.4.0_alpha1-numpy-2.patch
new file mode 100644
index 000000000000..13b6ffc9a94f
--- /dev/null
+++ b/dev-python/mpmath/files/mpmath-1.4.0_alpha1-numpy-2.patch
@@ -0,0 +1,32 @@
+From b80b0e08b75f41730a1116aebe34361e5d63d58c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 2 Jul 2024 08:11:58 +0200
+Subject: [PATCH] Fix the comparison in test_compatibility for NumPy 2.0.0
+
+The comparison in `mpmath/tests/test_convert.py::test_compatibility`
+failed for `np.float16` in NumPy 2.0.0 since `2.0**-53` cannot be
+represented in half-precision floating point type. Convert the LHS
+to `np.float64` to ensure that the comparison is done in sufficiently
+precise type.
+
+This fixes the actual test failure from #815 but the deprecation warning
+remains.
+---
+ mpmath/tests/test_convert.py | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mpmath/tests/test_convert.py b/mpmath/tests/test_convert.py
+index 5578b245..c6ef2187 100644
+--- a/mpmath/tests/test_convert.py
++++ b/mpmath/tests/test_convert.py
+@@ -254,7 +254,9 @@ def test_compatibility():
+ # Handle the weird types
+ try: diff = np.abs(type(np.sqrt(x))(sqrt(x)) - np.sqrt(x))
+ except: continue
+- assert diff < 2.0**-53
++ # numpy-2 does the comparison on LHS type, so we need to convert
++ # it to a type that can actually represent 2.0**-53
++ assert np.float64(diff) < 2.0**-53
+ assert mpf(np.float64('inf')) == inf
+ assert isnan(mp.npconvert(np.float64('nan')))
+ if hasattr(np, "float128"):
diff --git a/dev-python/mpmath/mpmath-1.4.0_alpha1.ebuild b/dev-python/mpmath/mpmath-1.4.0_alpha1.ebuild
new file mode 100644
index 000000000000..ef235883f25d
--- /dev/null
+++ b/dev-python/mpmath/mpmath-1.4.0_alpha1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( pypy3 python3_{10..13} )
+
+inherit distutils-r1 optfeature pypi
+
+DESCRIPTION="Python library for arbitrary-precision floating-point arithmetic"
+HOMEPAGE="
+ https://mpmath.org/
+ https://github.com/mpmath/mpmath/
+ https://pypi.org/project/mpmath/
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+
+BDEPEND="
+ dev-python/setuptools-scm[${PYTHON_USEDEP}]
+ test? (
+ dev-python/matplotlib[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ dev-python/pexpect[${PYTHON_USEDEP}]
+ dev-python/pytest-rerunfailures[${PYTHON_USEDEP}]
+ $(python_gen_cond_dep '
+ dev-python/gmpy[${PYTHON_USEDEP}]
+ ' 'python3*')
+ $(python_gen_cond_dep '
+ dev-python/ipython[${PYTHON_USEDEP}]
+ ' 3.{10..12})
+ )
+"
+
+EPYTEST_XDIST=1
+distutils_enable_tests pytest
+
+PATCHES=(
+ # https://github.com/mpmath/mpmath/pull/816
+ "${FILESDIR}/${P}-numpy-2.patch"
+)
+
+python_test() {
+ local EPYTEST_DESELECT=(
+ # TODO
+ mpmath/tests/test_cli.py::test_bare_console_bare_division
+ mpmath/tests/test_cli.py::test_bare_console_no_bare_division
+ mpmath/tests/test_cli.py::test_bare_console_pretty
+ mpmath/tests/test_cli.py::test_bare_console_without_ipython
+ mpmath/tests/test_cli.py::test_bare_console_wrap_floats
+ )
+
+ local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ epytest -p rerunfailures --reruns=5
+}
+
+pkg_postinst() {
+ optfeature "gmp support" dev-python/gmpy
+ optfeature "matplotlib support" dev-python/matplotlib
+}