summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-12-25 16:38:48 +0100
committerMichał Górny <mgorny@gentoo.org>2022-12-25 16:41:56 +0100
commitc21657c0f67d11ae2dbfd0d30fed9ce8c83bdf9c (patch)
tree548026aaea4005e4663b62233ee1f0aaa84787c4 /dev-python/quantities
parentpackage.mask: Last rite app-portage/gander (diff)
downloadgentoo-c21657c0f67d11ae2dbfd0d30fed9ce8c83bdf9c.tar.gz
gentoo-c21657c0f67d11ae2dbfd0d30fed9ce8c83bdf9c.tar.bz2
gentoo-c21657c0f67d11ae2dbfd0d30fed9ce8c83bdf9c.zip
dev-python/quantities: Backport numpy 1.24 fix
Also update archive since upstream fixed release tag. Closes: https://bugs.gentoo.org/888243 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/quantities')
-rw-r--r--dev-python/quantities/Manifest2
-rw-r--r--dev-python/quantities/files/quantities-0.13.0-numpy.patch68
-rw-r--r--dev-python/quantities/quantities-0.13.0-r2.ebuild (renamed from dev-python/quantities/quantities-0.13.0-r1.ebuild)12
3 files changed, 79 insertions, 3 deletions
diff --git a/dev-python/quantities/Manifest b/dev-python/quantities/Manifest
index 0495c7ec9fe7..b251a9fd4e51 100644
--- a/dev-python/quantities/Manifest
+++ b/dev-python/quantities/Manifest
@@ -1 +1 @@
-DIST python-quantities-0.13.0.tar.gz 107187 BLAKE2B ead5c223892f65c68ced2265356f8c1e5374f80a1507ec561370e56e28e8965217a7b99f5c46cb83a5f6a1b1f12eb9f501844650488871d48794f13a4383df38 SHA512 ec0a61d8df8e48e7ee08cab5c899a8c8ad96b964ee0132ab130f272f062436d91e6370aac9d85453eeb3d95e17e79e8dfb80412397eada1f0a4310c0494fa217
+DIST python-quantities-0.13.0.gh.tar.gz 107178 BLAKE2B f5fe69ed1d82bc90620a1cabf4c68f676330a2b09e8590bedf48ee8c46e3176d57e0dc6374d1112377056cd1138553d92f0bcaf0a68e2600e3631226e2262afc SHA512 d108b0f5bd834aeb7443693175d54b2b01fa9110cc57f0356681374ce95b5f57e39253d9c8166365aabc379f2f26bba3a827689ceb6c45595345e140b4cd7ad3
diff --git a/dev-python/quantities/files/quantities-0.13.0-numpy.patch b/dev-python/quantities/files/quantities-0.13.0-numpy.patch
new file mode 100644
index 000000000000..940bc846d687
--- /dev/null
+++ b/dev-python/quantities/files/quantities-0.13.0-numpy.patch
@@ -0,0 +1,68 @@
+From 29852b895d5d39006d1f129397cffae3578a694e Mon Sep 17 00:00:00 2001
+From: Andrew Davison <andrew.davison@cnrs.fr>
+Date: Thu, 7 Jul 2022 10:03:32 +0200
+Subject: [PATCH] fix failure to handle units with floordiv
+
+fixes #205
+---
+ quantities/dimensionality.py | 2 +-
+ quantities/tests/test_arithmetic.py | 16 +++++++++++++++-
+ 2 files changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/quantities/dimensionality.py b/quantities/dimensionality.py
+index cea68ca..d54f96f 100644
+--- a/quantities/dimensionality.py
++++ b/quantities/dimensionality.py
+@@ -238,6 +238,7 @@ def _d_divide(q1, q2, out=None):
+ return q2.dimensionality**-1
+ p_dict[np.divide] = _d_divide
+ p_dict[np.true_divide] = _d_divide
++p_dict[np.floor_divide] = _d_divide
+
+ def _d_check_uniform(q1, q2, out=None):
+ try:
+@@ -273,7 +274,6 @@ p_dict[np.subtract] = _d_check_uniform
+ p_dict[np.mod] = _d_check_uniform
+ p_dict[np.fmod] = _d_check_uniform
+ p_dict[np.remainder] = _d_check_uniform
+-p_dict[np.floor_divide] = _d_check_uniform
+ p_dict[np.hypot] = _d_check_uniform
+ p_dict[np.equal] = _d_check_uniform
+ p_dict[np.not_equal] = _d_check_uniform
+diff --git a/quantities/tests/test_arithmetic.py b/quantities/tests/test_arithmetic.py
+index fe5670e..534702c 100644
+--- a/quantities/tests/test_arithmetic.py
++++ b/quantities/tests/test_arithmetic.py
+@@ -52,7 +52,7 @@ class iter_dtypes:
+
+ def __init__(self):
+ self._i = 1
+- self._typeDict = np.typeDict.copy()
++ self._typeDict = np.sctypeDict.copy()
+ self._typeDict[17] = int
+ self._typeDict[18] = long
+ self._typeDict[19] = float
+@@ -132,6 +132,20 @@ class TestDTypes(TestCase):
+ self.check_rmul(x, y)
+ dtypes.pop(0)
+
++ def test_truediv(self):
++ q = Quantity([44, 40, 36, 32], units=pq.ms)
++ self.assertQuantityEqual(
++ q/(4 * pq.ms),
++ Quantity([11, 10, 9, 8], units=pq.dimensionless)
++ )
++
++ def test_floordiv(self):
++ q = Quantity([45, 43, 39, 32], units=pq.ms)
++ self.assertQuantityEqual(
++ q//(4 * pq.ms),
++ Quantity([11, 10, 9, 8], units=pq.dimensionless)
++ )
++
+ def test_mixed_addition(self):
+ self.assertQuantityEqual(1*pq.ft + 1*pq.m, 4.280839895 * pq.ft)
+ self.assertQuantityEqual(1*pq.ft + pq.m, 4.280839895 * pq.ft)
+--
+2.39.0
+
diff --git a/dev-python/quantities/quantities-0.13.0-r1.ebuild b/dev-python/quantities/quantities-0.13.0-r2.ebuild
index 10138c6a4687..72f622668aa3 100644
--- a/dev-python/quantities/quantities-0.13.0-r1.ebuild
+++ b/dev-python/quantities/quantities-0.13.0-r2.ebuild
@@ -10,10 +10,14 @@ inherit distutils-r1
MY_P="python-quantities-${PV}"
DESCRIPTION="Support for physical quantities with units, based on numpy"
-HOMEPAGE="https://github.com/python-quantities/python-quantities"
+HOMEPAGE="
+ https://github.com/python-quantities/python-quantities/
+ https://pypi.org/project/quantities/
+"
SRC_URI="
https://github.com/python-quantities/python-quantities/archive/v${PV}.tar.gz
- -> ${MY_P}.tar.gz"
+ -> ${MY_P}.gh.tar.gz
+"
S=${WORKDIR}/${MY_P}
LICENSE="BSD"
@@ -25,3 +29,7 @@ RDEPEND="
"
distutils_enable_tests pytest
+
+PATCHES=(
+ "${FILESDIR}"/${P}-numpy.patch
+)