Sync from SUSE:SLFO:Main python-matplotlib revision 742f0577fa82d47204b9ca3bdcd9a474

This commit is contained in:
2024-10-25 15:34:22 +02:00
parent 0111e373b9
commit 7ed582da26
9 changed files with 585 additions and 156 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file
# spec file for package python-matplotlib
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,6 +16,8 @@
#
%define SLE_VERSION 1600
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
@@ -26,19 +28,22 @@ ExclusiveArch: x86_64 aarch64
%define psuffix %{nil}
%bcond_with test
%endif
%bcond_with ringdisabled
%{?sle15_python_module_pythons}
Name: python-matplotlib%{psuffix}
Version: 3.6.3
Version: 3.9.0
Release: 0
Summary: Plotting Library for Python
License: SUSE-Matplotlib
URL: https://matplotlib.org
# SourceRepository: https://github.com/matplotlib/matplotlib
Source: https://files.pythonhosted.org/packages/source/m/matplotlib/matplotlib-%{version}.tar.gz
Source1: matplotlib-mplsetup.cfg
# Bundled version of freetype and qhull for testing purposes only
Source98: http://www.qhull.org/download/qhull-2020-src-8.0.2.tgz
# Use fixed versions of freetype and qhull for imagecomparison tests to succeed. See lib/matplotlib/__init__.py:_init_tests() and the meson .wrap files in subprojects/
Source98: https://github.com/qhull/qhull/archive/v8.0.2/qhull-8.0.2.tar.gz#/qhull-8.0.2.tgz
Source99: https://downloads.sourceforge.net/project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
Source100: python-matplotlib.rpmlintrc
# PATCH-FEATURE-OPENSUSE matplotlib-meson-options-opensuse.patch code@bnavigator.de -- Custom build options for meson-python
Patch0: matplotlib-meson-options-opensuse.patch
Recommends: ghostscript
Recommends: libxml2-tools
Recommends: poppler-tools
@@ -47,12 +52,12 @@ Recommends: (%{python_flavor}-matplotlib-tk if tk)
Provides: python-matplotlib-gtk = %{version}
Obsoletes: python-matplotlib-gtk < %{version}
# SECTION build
BuildRequires: %{python_module devel >= 3.8}
BuildRequires: %{python_module numpy-devel >= 1.19}
BuildRequires: %{python_module devel >= 3.9}
BuildRequires: %{python_module meson-python >= 0.13.1}
BuildRequires: %{python_module numpy-devel >= 1.25 with %python-numpy-devel < 2.3}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pybind11-devel >= 2.6}
BuildRequires: %{python_module setuptools_scm >= 7}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: c++_compiler
BuildRequires: fdupes
BuildRequires: pkgconfig
@@ -68,13 +73,16 @@ BuildRequires: pkgconfig(tcl)
# SECTION runtime
Requires: python-Cycler >= 0.10
Requires: python-FontTools >= 4.22.0
Requires: python-Pillow >= 6.2.0
Requires: python-Pillow >= 8
Requires: python-contourpy >= 1.0.1
Requires: python-kiwisolver >= 1.0.1
Requires: python-numpy >= 1.19
Requires: python-kiwisolver >= 1.3.1
Requires: python-numpy >= 1.23
Requires: python-packaging >= 20.0
Requires: python-pyparsing > 2.2.1
Requires: python-pyparsing > 2.3.1
Requires: python-python-dateutil >= 2.7
%if 0%{?python_version_nodots} < 310
Requires: python-importlib-resources >= 3.2.0
%endif
# /SECTION
# SECTION test
%if %{with test}
@@ -86,17 +94,44 @@ BuildRequires: %{python_module matplotlib-qt5 = %{version}}
BuildRequires: %{python_module matplotlib-testdata = %{version}}
BuildRequires: %{python_module matplotlib-tk = %{version}}
BuildRequires: %{python_module matplotlib-web = %{version}}
BuildRequires: %{python_module matplotlib-wx = %{version}}
BuildRequires: %{python_module psutil}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest-xvfb}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module pytz}
%if 0%{?suse_version} > %SLE_VERSION
BuildRequires: %{python_module matplotlib-nbagg = %{version} if %python-base >= 3.10}
%endif
%if 0%{?suse_version} > %SLE_VERSION
BuildRequires: %{python_module matplotlib-wx = %{version}}
%endif
# SECTION latex test dependencies
BuildRequires: %{python_module matplotlib-latex = %{version}}
BuildRequires: Mesa-dri
BuildRequires: ghostscript
BuildRequires: inkscape
BuildRequires: poppler-tools
# /SECTION
# /SECTION latex
# SECTION cairo backend options
BuildRequires: %{python_module cairo >= 1.14.0}
BuildRequires: %{python_module cairocffi >= 0.8}
# /SECTION cairo
# SECTION nbagg backend tests
%if %{without ringdisabled} && 0%{?suse_version} > %SLE_VERSION
BuildRequires: %{python_module nbconvert if %python-base >= 3.10}
BuildRequires: %{python_module nbformat if %python-base >= 3.10}
%endif
# /SECTION nbagg
# SECTION qt backends: Only test PyQt5 in Minimal-X
BuildRequires: %{python_module qt5}
%if %{without ringdisabled}
%if 0%{?suse_version} > %SLE_VERSION
BuildRequires: %{python_module PyQt6}
BuildRequires: python3-pyside2
BuildRequires: python3-pyside6
%endif
%endif
# /SECTION qt
# /SECTION test
%endif
%python_subpackages
@@ -111,7 +146,7 @@ application servers, and six graphical user interface toolkits.
%package cairo
Summary: Cairo backend for %{name}
Requires: %{name} = %{version}
Requires: python-cairo
Requires: (python-cairo or python-cairocffi)
%description cairo
This package includes the non-interactive Cairo-based backend
@@ -147,6 +182,15 @@ Requires: python-gobject-cairo
This package provides code common for the GTK3 and GTK4 backends
for the %{name} plotting package
%package nbagg
Summary: Jupyter nbagg backend for %{name}
Requires: %{name} = %{version}
Requires: python-ipykernel
%description nbagg
This package includes the Jupyter notebook backend
for the %{name} plotting package
%package latex
Summary: Allow rendering latex in %{name}
Requires: %{name} = %{version}
@@ -163,6 +207,7 @@ Requires: texlive-sfmath
Requires: texlive-tex
Requires: texlive-txfonts
Requires: texlive-xcolor
Requires: texlive-xetex
Requires: tex(avant.sty)
Requires: tex(chancery.sty)
Requires: tex(charter.sty)
@@ -183,16 +228,20 @@ BuildArch: noarch
This package allows %{name} to display latex in plots
and figures.
%package qt5
Summary: Qt5 backend for %{name}
%package qt
Summary: Qt backend for %{name}
Requires: %{name} = %{version}
Requires: python-qt5
Requires: (python-qt5 or python-PyQt6 >= 6.1 or python-pyside2 or python-pyside6)
Provides: %{name}-qt-shared = %{version}
Provides: %{name}-qt5 = %{version}
Obsoletes: %{name}-qt-shared < %{version}
# Renamed at upgrade from MPL 3.6.3 to 3.8.2
Obsoletes: %{name}-qt5 < 3.8.2
%description qt5
This package includes the Qt5-based pyqt5 backend
%description qt
This package includes the Qt-based backend
for the %{name} plotting package
PyQt5, PyQt6, Pyside2 or Pyside 6 may be used
%package testdata
Summary: Test data for %{name}
@@ -207,7 +256,7 @@ Summary: Tk backend for %{name}
Requires: %{name} = %{version}
Requires: python-Pillow-tk
Requires: python-tk
Requires: tcl >= 8.3
Requires: tcl >= 8.5
%description tk
This package includes the Tk-based tkagg backend
@@ -222,6 +271,7 @@ Requires: python-tornado
This package includes the browser-based webagg backend
for the %{name} plotting package
%if 0%{?suse_version} > %SLE_VERSION
%package wx
Summary: WxWidgets backend for %{name}
Requires: %{name} = %{version}
@@ -230,30 +280,28 @@ Requires: python-wxPython >= 4
%description wx
This package includes the wxWidgets-based wxagg backend
for %{name} plotting package
%endif
%prep
%autosetup -p1 -n matplotlib-%{version}
# Copy freetype to the right location, so that matplotlib will not try to download it
mkdir -p ~/.cache/matplotlib/
SHA=($(sha256sum %{SOURCE98}))
cp %{SOURCE98} ~/.cache/matplotlib/${SHA}
SHA=($(sha256sum %{SOURCE99}))
cp %{SOURCE99} ~/.cache/matplotlib/${SHA}
# Copy freetype and qhull to the right location, so that matplotlib will not try to download it
mkdir subprojects/packagecache
cp %{SOURCE98} %{SOURCE99} subprojects/packagecache/
chmod -x lib/matplotlib/mpl-data/images/*.svg
find examples lib/matplotlib lib/mpl_toolkits/mplot3d -type f -name "*.py" -exec sed -i "s|#!\/usr\/bin\/env python||" {} \;
find examples lib/matplotlib lib/mpl_toolkits/mplot3d -type f -name "*.py" -exec sed -i "s|#!\/usr\/bin\/python||" {} \;
cp %{SOURCE1} mplsetup.cfg
# The setup procedure wants certifi to download packages over https. Not applicable here.
sed -i '/"certifi>=.*"/ d' setup.py
find lib/matplotlib lib/mpl_toolkits/mplot3d -type f -name "*.py" -exec sed -i "1{/#!.*python/ d}" {} \;
%{python_expand # use the last python in the buildset as generator (only the pythons in the buildset have setuptools_scm installed)
myprimarypython=%{__$python}
}
sed -i "s|find_program('python3')|'$myprimarypython'|" meson.build
find tools -type f -name "*.py" -exec sed -i "1{s|^#!.*python\S*|#!$myprimarypython|}" {} \;
%build
%if !%{with test}
%if %{without test}
%pyproject_wheel
%endif
%install
%if !%{with test}
%if %{without test}
%pyproject_install
%{python_expand sed -i -e "s/install matplotlib from source/install the $python-matplotlib-testdata package/" \
%{buildroot}%{$python_sitearch}/matplotlib/tests/__init__.py
@@ -264,6 +312,11 @@ sed -i '/"certifi>=.*"/ d' setup.py
%if %{with test}
%check
# force 'swrast' ("llvmpipe") Mesa/OpenGL driver to be used by
# setting and exporting LIBGL_ALWAYS_SOFTWARE=1 to get rid of
# issues when Mesa is trying to load 'zink' driver (messages are
# just warnings, but seem to be fatal for the tests here) (boo#1219095)
export LIBGL_ALWAYS_SOFTWARE=1
# fails to detect alternative backend within xvfb
skip_tests+=" or test_backend_fallback_headful"
# test_usetex.py::test_usetex[png] - no tex text -- do not skip test_empty[png] and test_unicode_minus[png]
@@ -282,33 +335,51 @@ skip_tests+=" or _sigint"
skip_tests+=" or test_get_font_names"
# different default font
skip_tests+=" or test_bold_font_output_with_none_fonttype"
# different position values on python311 (different version in a dependency or different font?)
skip_tests+=" or test_compressed1"
%ifnarch x86_64
# image comparison failures due to precisions dicrepancies to the x86 produced references
skip_tests+=" or png or svg or pdf"
%endif
# backend tests landing in the wrong xdist process may fail with an error. Test them without xdist.
no_xdist="test_backend or test_span_selector_animated_artists_callback"
%{pytest_arch --pyargs matplotlib.tests \
--pyargs mpl_toolkits.tests \
-n auto \
-m "not network" \
-vv \
-k "not (${no_xdist} ${skip_tests})"
}
%pytest_arch --pyargs matplotlib.tests -k "(${no_xdist}) and not (${skip_tests:4})"
# Fails in SLFO:Main
%if 0%{?suse_version} <= %SLE_VERSION
# Timeout, this test freeze forever
skip_tests+=" or test_determinism"
skip_tests+=" or test_pcolormesh[png] or test_pcolormesh_alpha[png]"
%endif
%if !%{with test}
# backend tests landing in the wrong xdist process may fail with an error. Test them without xdist.
no_xdist="test_backend or test_span_selector_animated_artists_callback"
%{python_expand # see https://matplotlib.org/devdocs/devel/testing.html#testing
# if one of the pyargs modules is not present, the xargs collection looks empty
# Ignore ImportWarning that happens with gtk3
$python -m pytest --pyargs matplotlib.tests \
mpl_toolkits.axes_grid1.tests \
mpl_toolkits.axisartist.tests \
mpl_toolkits.mplot3d.tests \
-n auto \
-W "ignore::ImportWarning" \
-m "not network" \
-vv -rsfE \
-k "not (${no_xdist} ${skip_tests})"
$python -m pytest --pyargs matplotlib.tests \
-vv -rsfE \
-W "ignore::ImportWarning" \
-k "(${no_xdist}) and not (${skip_tests:4})"
}
%endif
%if %{without test}
%files %{python_files}
%doc README.rst
%doc examples/
%doc README.md
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/
%{python_sitearch}/matplotlib
%{python_sitearch}/matplotlib-%{version}.dist-info
%{python_sitearch}/matplotlib-%{version}-py*-nspkg.pth
%{python_sitearch}/mpl_toolkits
%dir %{python_sitearch}/mpl_toolkits
%{python_sitearch}/mpl_toolkits/axes_grid1
%{python_sitearch}/mpl_toolkits/axisartist
%{python_sitearch}/mpl_toolkits/mplot3d
%{python_sitearch}/pylab.py*
%pycache_only %{python_sitearch}/__pycache__/pylab.*
%exclude %{python_sitearch}/matplotlib/backends/_backend_tk.py
@@ -320,6 +391,7 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%exclude %{python_sitearch}/matplotlib/backends/backend_gtk4.*
%exclude %{python_sitearch}/matplotlib/backends/backend_gtk4agg.*
%exclude %{python_sitearch}/matplotlib/backends/backend_gtk4cairo.*
%exclude %{python_sitearch}/matplotlib/backends/backend_nbagg.*
%exclude %{python_sitearch}/matplotlib/backends/backend_qt5.*
%exclude %{python_sitearch}/matplotlib/backends/backend_qt5agg.*
%exclude %{python_sitearch}/matplotlib/backends/backend_qt5cairo.py*
@@ -342,6 +414,7 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk4.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk4agg.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_gtk4cairo.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_nbagg.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt5.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt5agg.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_qt5cairo.*.py*
@@ -354,23 +427,22 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/backend_wxcairo.*.py*
%exclude %{python_sitearch}/matplotlib/backends/__pycache__/qt_compat.*.py*
%exclude %{python_sitearch}/matplotlib/tests/baseline_images
%exclude %{python_sitearch}/mpl_toolkits/axes_grid1/tests/baseline_images
%exclude %{python_sitearch}/mpl_toolkits/axisartist/tests/baseline_images
%exclude %{python_sitearch}/mpl_toolkits/mplot3d/tests/baseline_images
%exclude %{python_sitearch}/matplotlib/tests/tinypages
%exclude %{python_sitearch}/mpl_toolkits/tests/baseline_images
# Dummy package to pull in latex dependencies.
%files %{python_files latex}
%license LICENSE/
%license doc/users/project/license.rst
%files %{python_files cairo}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_cairo.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_cairo.*.py*
%files %{python_files gtk3}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_gtk3.py*
%{python_sitearch}/matplotlib/backends/backend_gtk3agg.py*
%{python_sitearch}/matplotlib/backends/backend_gtk3cairo.py*
@@ -380,7 +452,6 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%files %{python_files gtk4}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_gtk4.py*
%{python_sitearch}/matplotlib/backends/backend_gtk4agg.py*
%{python_sitearch}/matplotlib/backends/backend_gtk4cairo.py*
@@ -390,13 +461,18 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%files %{python_files gtk-common}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/_backend_gtk.py
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/_backend_gtk.*.py*
%files %{python_files qt5}
%if 0%{?suse_version} > %SLE_VERSION && 0%{?python_version_nodots} >= 310
%files %{python_files nbagg}
%license LICENSE/
%{python_sitearch}/matplotlib/backends/backend_nbagg.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_nbagg.*.py*
%endif
%files %{python_files qt}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_qt5.py*
%{python_sitearch}/matplotlib/backends/backend_qt5agg.py*
%{python_sitearch}/matplotlib/backends/backend_qt5cairo.py*
@@ -409,16 +485,16 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%files %{python_files testdata}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/tests/baseline_images
%{python_sitearch}/mpl_toolkits/axes_grid1/tests/baseline_images
%{python_sitearch}/mpl_toolkits/axisartist/tests/baseline_images
%{python_sitearch}/mpl_toolkits/mplot3d/tests/baseline_images
%{python_sitearch}/matplotlib/tests/tinypages
%{python_sitearch}/mpl_toolkits/tests/baseline_images
%exclude %{python_sitearch}/matplotlib/tests/tinypages/.gitignore
%exclude %{python_sitearch}/matplotlib/tests/tinypages/_static/.gitignore
%files %{python_files tk}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/_backend_tk.py*
%{python_sitearch}/matplotlib/backends/backend_tkagg.py*
%{python_sitearch}/matplotlib/backends/backend_tkcairo.py*
@@ -428,7 +504,6 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%files %{python_files web}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_webagg.py*
%{python_sitearch}/matplotlib/backends/backend_webagg_core.py*
%{python_sitearch}/matplotlib/backends/web_backend/
@@ -436,9 +511,9 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_webagg.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_webagg_core.*.py*
%if 0%{?suse_version} > %SLE_VERSION
%files %{python_files wx}
%license LICENSE/
%license doc/users/project/license.rst
%{python_sitearch}/matplotlib/backends/backend_wx.py*
%{python_sitearch}/matplotlib/backends/backend_wxagg.py*
%{python_sitearch}/matplotlib/backends/backend_wxcairo.py*
@@ -446,5 +521,6 @@ no_xdist="test_backend or test_span_selector_animated_artists_callback"
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_wxagg.*.py*
%pycache_only %{python_sitearch}/matplotlib/backends/__pycache__/backend_wxcairo.*.py*
%endif
%endif
%changelog