public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-pint] rpmlint-etc: Support numpy 1.24.x some types removal which were already deprecated
@ 2026-09-12 10:21 Mamoru TASAKA
  0 siblings, 0 replies; only message in thread
From: Mamoru TASAKA @ 2026-09-12 10:21 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/python-pint
            Branch : rpmlint-etc
            Commit : 83adb07ab743676e9f17266e4793e0ef90dc76ec
            Author : Mamoru TASAKA <mtasaka@fedoraproject.org>
            Date   : 2023-07-16T18:46:48+09:00
            Stats  : +24/-1 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/python-pint/c/83adb07ab743676e9f17266e4793e0ef90dc76ec?branch=rpmlint-etc

            Log:
            Support numpy 1.24.x some types removal which were already deprecated

Workaround python3.12 changes for Fractions which now returns ValueError
  instead of TypeError
Fix for python3.12 with unittest.assertEquals removal

---
diff --git a/python-pint.spec b/python-pint.spec
index 8440009..98f4097 100644
--- a/python-pint.spec
+++ b/python-pint.spec
@@ -3,7 +3,7 @@
 
 Name:           python-pint
 Version:        0.16.1
-Release:        10%{?dist}
+Release:        11%{?dist}
 Summary:        Physical quantities module
 
 License:        BSD
@@ -62,6 +62,23 @@ Documentation for the pint module
 %prep
 %setup -q -n %{pypi_name}-%{version}
 
+# numpy 1.24.x removes np.float np.alen and so on
+grep -rl "dtype=np\.float" . | xargs sed -i -e 's|dtype=np\.float|dtype=float|'
+sed -i pint/testsuite/test_numpy.py \
+	-e 's|dtype=float32|dtype=np.float32|' \
+	-e 's|dtype=float64|dtype=np.float64|' \
+	-e 's|np\.alen|len|' \
+	%{nil}
+
+# Passing format_spec = 'n' to Fraction causes TypeError with python3.11 and below,
+# now causes ValueError. Workaround for this
+# https://github.com/python/cpython/commit/3e09f3152e518cdc8779b52943b86812114ce071#diff-f561eb7eb97f832b2698837f52c2c2cf23bdb0b31c69cf1f6aaa560280993316R417
+# FIXME this one must be reported upstream
+sed -i pint/testsuite/__init__.py -e '115s|except TypeError:|except (TypeError, ValueError):|'
+
+# python 3.12 removes deprecated unittest.assertEquals
+sed -i pint/testsuite/test_contexts.py -e 's|self.assertEquals|self.assertEqual|'
+
 # drop numpy version requirement
 sed -i '/@helpers.requires_numpy_at_least("1.16")/d' pint/testsuite/test_quantity.py
 
@@ -98,6 +115,12 @@ rm -rf html/.{doctrees,buildinfo}
 %endif
 
 %changelog
+* Sun Jul 16 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 0.16.1-11
+- Support numpy 1.24.x some types removal which were already deprecated
+- Workaround python3.12 changes for Fractions which now returns ValueError
+  instead of TypeError
+- Fix for python3.12 with unittest.assertEquals removal
+
 * Tue Jun 27 2023 Python Maint <python-maint@redhat.com> - 0.16.1-10
 - Rebuilt for Python 3.12
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-12 10:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-12 10:21 [rpms/python-pint] rpmlint-etc: Support numpy 1.24.x some types removal which were already deprecated Mamoru TASAKA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox