public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-matplotlib] rawhide: fix building on RISC-V architecture
@ 2026-11-20 0:34 Marcin Juszkiewicz
0 siblings, 0 replies; only message in thread
From: Marcin Juszkiewicz @ 2026-11-20 0:34 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-matplotlib
Branch : rawhide
Commit : 67533d1c77f4ece65f04622dae19429d887edb63
Author : Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
Date : 2026-11-18T09:27:11+01:00
Stats : +124/-0 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/python-matplotlib/c/67533d1c77f4ece65f04622dae19429d887edb63?branch=rawhide
Log:
fix building on RISC-V architecture
We need more time for tests.
Some tests needs to be skipped due to slowness of RISC-V.
Use fixes backported from upstream.
---
diff --git a/0003-Fix-AsinhLocator-invalid-value-warning-in-np.floor-o.patch b/0003-Fix-AsinhLocator-invalid-value-warning-in-np.floor-o.patch
new file mode 100644
index 0000000..37163b7
--- /dev/null
+++ b/0003-Fix-AsinhLocator-invalid-value-warning-in-np.floor-o.patch
@@ -0,0 +1,34 @@
+From 7bef015ebdf0a0e34a93b308490a9f77a90af4a2 Mon Sep 17 00:00:00 2001
+From: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
+Date: Fri, 2 Oct 2026 12:33:59 +0200
+Subject: [PATCH] Fix AsinhLocator invalid value warning in np.floor on riscv64
+
+np.log10(0) produces -inf, and np.floor(-inf) is fine. But on riscv64
+the intermediate NaN from the full expression evaluation triggers
+"RuntimeWarning: invalid value encountered in floor". The existing
+errstate only suppresses "divide" warnings but not "invalid".
+
+This causes TestAsinhLocator tests and test_minorticks_toggle to fail
+on riscv64.
+
+---
+ lib/matplotlib/ticker.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py
+index 391e24dd2a..820e5cc18e 100644
+--- a/lib/matplotlib/ticker.py
++++ b/lib/matplotlib/ticker.py
+@@ -2890,7 +2890,8 @@ class AsinhLocator(Locator):
+
+ # Round the data-space values to be intuitive base-n numbers, keeping track of
+ # positive and negative values separately and carefully treating the zero value.
+- with np.errstate(divide="ignore"): # base ** log(0) = base ** -inf = 0.
++ # base ** log(0) = base ** -inf = 0.
++ with np.errstate(divide="ignore", invalid="ignore"):
+ if self.base > 1:
+ pows = (np.sign(xs)
+ * self.base ** np.floor(np.log(abs(xs)) / math.log(self.base)))
+--
+2.55.0
+
diff --git a/0004-Increase-subprocess-test-timeout-for-slow-architectu.patch b/0004-Increase-subprocess-test-timeout-for-slow-architectu.patch
new file mode 100644
index 0000000..8c63a6a
--- /dev/null
+++ b/0004-Increase-subprocess-test-timeout-for-slow-architectu.patch
@@ -0,0 +1,77 @@
+From 472196652bdab855fbe5cbde11b6fbd4911b44fa Mon Sep 17 00:00:00 2001
+From: Marcin Juszkiewicz <mjuszkiewicz@redhat.com>
+Date: Fri, 2 Oct 2026 12:34:21 +0200
+Subject: [PATCH] Increase subprocess test timeout for slow architectures
+
+The default 60-second timeout in subprocess_run_for_testing is too
+short for riscv64, causing test_sphinxext and test_determinism_check
+to fail with TimeoutExpired.
+
+Increase the default by 6 for CI environments.
+
+Adapted to apply to 3.11.2 version.
+---
+ lib/matplotlib/tests/test_determinism.py | 7 +++++--
+ lib/matplotlib/tests/test_sphinxext.py | 7 +++++--
+ 2 files changed, 10 insertions(+), 4 deletions(-)
+
+Index: matplotlib-3.11.2/lib/matplotlib/tests/test_determinism.py
+===================================================================
+--- matplotlib-3.11.2.orig/lib/matplotlib/tests/test_determinism.py
++++ matplotlib-3.11.2/lib/matplotlib/tests/test_determinism.py
+@@ -15,7 +15,7 @@ from matplotlib.image import BboxImage
+ from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox
+ from matplotlib.patches import Circle, PathPatch
+ from matplotlib.path import Path
+-from matplotlib.testing import subprocess_run_for_testing
++from matplotlib.testing import subprocess_run_for_testing, is_ci_environment
+ from matplotlib.testing._markers import needs_ghostscript, needs_usetex
+ import matplotlib.testing.compare
+ from matplotlib.text import TextPath
+@@ -180,13 +180,16 @@ def test_determinism_check(objects, fmt,
+ fmt : {"pdf", "ps", "svg"}
+ Output format.
+ """
++ timeout = 60
++ if is_ci_environment():
++ timeout *= 6
+ plots = [
+ subprocess_run_for_testing(
+ [sys.executable, "-R", "-c",
+ f"from matplotlib.tests.test_determinism import _save_figure;"
+ f"_save_figure({objects!r}, {fmt!r}, {usetex})"],
+ env={**os.environ, "SOURCE_DATE_EPOCH": "946684800",
+- "MPLBACKEND": "Agg"},
++ "MPLBACKEND": "Agg"}, timeout=timeout,
+ text=False, capture_output=True, check=True).stdout
+ for _ in range(3)
+ ]
+Index: matplotlib-3.11.2/lib/matplotlib/tests/test_sphinxext.py
+===================================================================
+--- matplotlib-3.11.2.orig/lib/matplotlib/tests/test_sphinxext.py
++++ matplotlib-3.11.2/lib/matplotlib/tests/test_sphinxext.py
+@@ -6,7 +6,7 @@ from pathlib import Path
+ import shutil
+ import sys
+
+-from matplotlib.testing import subprocess_run_for_testing
++from matplotlib.testing import subprocess_run_for_testing, is_ci_environment
+ import pytest
+
+
+@@ -21,11 +21,14 @@ def build_sphinx_html(source_dir, doctre
+ extra_args = [] if extra_args is None else extra_args
+ cmd = [sys.executable, '-msphinx', '-W', '-b', 'html',
+ '-d', str(doctree_dir), str(source_dir), str(html_dir), *extra_args]
++ timeout = 60
++ if is_ci_environment():
++ timeout *= 6
+ # On CI, gcov emits warnings (due to agg headers being included with the
+ # same name in multiple extension modules -- but we don't care about their
+ # coverage anyways); hide them using GCOV_ERROR_FILE.
+ proc = subprocess_run_for_testing(
+- cmd, capture_output=True, text=True,
++ cmd, capture_output=True, text=True, timeout=timeout,
+ env={**os.environ, "MPLBACKEND": "", "GCOV_ERROR_FILE": os.devnull}
+ )
+ out = proc.stdout
diff --git a/python-matplotlib.spec b/python-matplotlib.spec
index 80453e9..0f9daae 100644
--- a/python-matplotlib.spec
+++ b/python-matplotlib.spec
@@ -52,6 +52,10 @@ Patch1002: 0002-Set-FreeType-version-to-%{ftver}-and-update-tolerances.patc
# libraqm is still 0.10.1
# https://src.fedoraproject.org/rpms/libraqm/pull-request/8
Patch1003: 0002-Reduce-required-libraqm-version.patch
+# riscv64: fix RuntimeWarning from np.floor on NaN/inf in AsinhLocator
+Patch1004: 0003-Fix-AsinhLocator-invalid-value-warning-in-np.floor-o.patch
+# riscv64: increase default subprocess test timeout (60s too short)
+Patch1005: 0004-Increase-subprocess-test-timeout-for-slow-architectu.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -364,6 +368,10 @@ mktexfmt xelatex.fmt
# Also prime the font cache.
%{py3_test_envvars} %{python3} -c 'import matplotlib.font_manager'
+# Activate matplotlib's CI timeout multiplier (6x) for slow architectures.
+# We need it on riscv64.
+export CI=1
+
export http_proxy=http://127.0.0.1/
# This test checks for "slowness" that often fails on a heavily-loaded builder.
@@ -386,6 +394,11 @@ k="${k-}${k+ and }not test_interactive_timers"
# These two segfault, resp. timeout in Python 3.14 Copr test environment
k="${k-}${k+ and }not test_interactive_thread_safety"
k="${k-}${k+ and }not test_figuremanager_cleans_own_mainloop"
+%ifarch riscv64
+# wxagg: show() changes figure size; qtcairo: SIGINT race condition
+k="${k-}${k+ and }not (test_interactive_backend and wxagg)"
+k="${k-}${k+ and }not (test_sigint and qtcairo)"
+%endif
# Run backend tests with Wayland.
wlheadless-run -- env MPLCONFIGDIR=$PWD GDK_BACKEND=wayland QT_QPA_PLATFORM=wayland \
%{pytest} -vra -n auto \
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-20 0:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 0:34 [rpms/python-matplotlib] rawhide: fix building on RISC-V architecture Marcin Juszkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox