%global with_html 0 # It seems like there's some kind of weird occasional error where a # build (often aarch64 or ppc64) will fail in one of the Stix font # tests with a huge RMS difference, but if you run the same build again, # you won't get the same error. Unless someone can figure out what's # going on, we just have to keep re-running the build until it doesn't # happen. %global run_tests 0 # the default backend; one of GTK3Agg GTK3Cairo MacOSX Qt4Agg Qt5Agg TkAgg # WXAgg Agg Cairo PS PDF SVG %global backend Qt5Agg %if "%{backend}" == "TkAgg" %global backend_subpackage tk %else %if "%{backend}" == "Qt5Agg" %global backend_subpackage qt5 %else %if "%{backend}" == "WXAgg" %global backend_subpackage wx %endif %endif %endif # https://fedorahosted.org/fpc/ticket/381 %global with_bundled_fonts 1 # Use the same directory of the main package for subpackage licence and docs %global _docdir_fmt %{name} #global rctag rc2 # Updated test images for new FreeType. %global mpl_images_version 3.8.1 # The version of FreeType in this Fedora branch. %global ftver 2.13.1 Name: python-matplotlib Version: 3.8.2 Release: %mkrel 4 Summary: Python 2D plotting library Group: Development/Python # qt4_editor backend is MIT License: Python and MIT URL: https://matplotlib.org/ Source0: https://github.com/matplotlib/matplotlib/archive/v%{version}%{?rctag}/matplotlib-%{version}%{?rctag}.tar.gz Source1: setup.cfg # Fedora-specific patches; see: # https://github.com/fedora-python/matplotlib/tree/fedora-patches # Updated test images for new FreeType. Source1000: https://github.com/QuLogic/mpl-images/archive/v%{mpl_images_version}-with-freetype-%{ftver}/matplotlib-%{mpl_images_version}-with-freetype-%{ftver}.tar.gz # Define location of matplotlibrc file Patch1001: 0001-matplotlibrc-path-search-fix.patch # We don't need to use NumPy 1.25. Patch1002: 0002-Unpin-NumPy-build-requirement.patch # Increase tolerances for new FreeType everywhere: Patch1003: 0003-Set-FreeType-version-to-%{ftver}-and-update-tolerances.patch # https://github.com/matplotlib/matplotlib/pull/21190#issuecomment-1223271888 Patch0001: 0004-Use-old-stride_windows-implementation-on-32-bit-x86.patch # https://github.com/matplotlib/matplotlib/pull/26502 Patch0002: 0005-TST-Increase-some-tolerances-for-non-x86-arches.patch # Mageia patches # Patch5000: matplotlib-matplotlib-3.3.1-pyparsing-reqs.patch BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: locales-en BuildRequires: freetype-devel BuildRequires: libpng-devel BuildRequires: qhull-devel BuildRequires: texlive BuildRequires: texlive-dist BuildRequires: x11-server-xvfb BuildRequires: zlib-devel BuildRequires: fonts-ttf-dejavu BuildRequires: python3-pip BuildRequires: pyproject-rpm-macros BuildRequires: python3dist(setuptools-scm) %description Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shell, web application servers, and various graphical user interface toolkits. Matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. %package -n python3-matplotlib-data Summary: Data used by python-matplotlib BuildArch: noarch Group: Development/Python %if %{with_bundled_fonts} Requires: python3-matplotlib-data-fonts = %{version}-%{release} %endif %{?python_provide:%python_provide python3-matplotlib-data} %description -n python3-matplotlib-data %{summary}. %if %{with_bundled_fonts} %package -n python3-matplotlib-data-fonts Summary: Fonts used by python-matplotlib # STIX and Computer Modern is OFL # DejaVu is Bitstream Vera and Public Domain License: OFL and Bitstream Vera and Public Domain BuildArch: noarch Requires: python3-matplotlib-data = %{version}-%{release} %{?python_provide:%python_provide python3-matplotlib-data-fonts} %description -n python3-matplotlib-data-fonts %{summary}. %endif %package -n python3-matplotlib %{?python_provide:%python_provide python3-matplotlib} Summary: Python 2D plotting library Group: Development/Python BuildRequires: python3-cairo BuildRequires: python3-certifi >= 2020.06.20 BuildRequires: python3-cycler >= 0.10.0 BuildRequires: python3-dateutil BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-gobject BuildRequires: python3-kiwisolver BuildRequires: python3-numpy-devel BuildRequires: python3-pillow BuildRequires: python3-pyparsing BuildRequires: python3-pytz BuildRequires: python3-sphinx Requires: fonts-ttf-dejavu # for dvipng Requires: texlive Requires: python3-matplotlib-data = %{version}-%{release} Requires: python3-cairo Requires: python3-cycler >= 0.10.0 Requires: python3-dateutil Requires: python3-kiwisolver Requires: python3-matplotlib-%{?backend_subpackage}%{!?backend_subpackage:tk}%{?_isa} = %{version}-%{release} %if %{run_tests} BuildRequires: python3-pytest BuildRequires: python3-pytest-rerunfailures BuildRequires: python3-pytest-timeout BuildRequires: python3-pytest-xdist %endif Requires: python3-numpy Recommends: python3-pillow Requires: python3-pyparsing %if !%{with_bundled_fonts} Requires: stix-math-fonts %else Provides: bundled(stix-math-fonts) %endif %{?python_provide:%python_provide python3-matplotlib} %description -n python3-matplotlib Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. Matplotlib can be used in Python scripts, the Python and IPython shell, web application servers, and various graphical user interface toolkits. Matplotlib tries to make easy things easy and hard things possible. You can generate plots, histograms, power spectra, bar charts, errorcharts, scatterplots, etc, with just a few lines of code. %package -n python3-matplotlib-qt5 Summary: Qt5 backend for python3-matplotlib Group: Development/Python BuildRequires: python3-qt5 Requires: python3-matplotlib%{?_isa} = %{version}-%{release} Requires: python3-qt5 %{?python_provide:%python_provide python3-matplotlib-qt5} %description -n python3-matplotlib-qt5 %{summary}. %package -n python3-matplotlib-qt6 Summary: Qt6 backend for python3-matplotlib Group: Development/Python BuildRequires: python3-qt6 Requires: python3-matplotlib%{?_isa} = %{version}-%{release} Requires: python3-qt6 %{?python_provide:%python_provide python3-matplotlib-qt6} %description -n python3-matplotlib-qt6 %{summary}. %package -n python3-matplotlib-gtk3 Summary: GTK3 backend for python3-matplotlib Group: Development/Python # This should be converted to typelib(Gtk) when supported BuildRequires: gtk3-devel BuildRequires: python3-gobject Requires: python3-gobject%{?_isa} Requires: python3-matplotlib%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python3-matplotlib-gtk3} %description -n python3-matplotlib-gtk3 %{summary}. %package -n python3-matplotlib-tk Summary: Tk backend for python3-matplotlib Group: Development/Python BuildRequires: python3-tkinter Requires: python3-matplotlib%{?_isa} = %{version}-%{release} Requires: python3-tkinter %{?python_provide:%python_provide python3-matplotlib-tk} %description -n python3-matplotlib-tk %{summary}. %package -n python3-matplotlib-wx Summary: WX backend for python3-matplotlib BuildRequires: python3-wxpython4 Requires: python3-matplotlib%{?_isa} = %{version}-%{release} Requires: python3-wxpython4 %{?python_provide:%python_provide python3-matplotlib-wx} %description -n python3-matplotlib-wx %{summary}. %package -n python3-matplotlib-doc Summary: Documentation files for python-matplotlib %if %{with_html} BuildRequires: dvipng BuildRequires: graphviz BuildRequires: python3-sphinx BuildRequires: tex(latex) BuildRequires: tex-preview BuildRequires: js-jquery >= 3.2.1 BuildRequires: xstatic-jquery-ui-common Requires: js-jquery >= 3.2.1 Requires: xstatic-jquery-ui-common %endif Requires: python3-matplotlib%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python3-matplotlib-doc} %description -n python3-matplotlib-doc %{summary}. %package -n python3-matplotlib-test-data Summary: Test data for python3-matplotlib Requires: python3-matplotlib%{?_isa} = %{version}-%{release} %{?python_provide:%python_provide python3-matplotlib-test-data} %description -n python3-matplotlib-test-data %{summary}. %prep %autosetup -n matplotlib-%{version} -N # Fedora-specific patches follow: %autopatch -p1 -m 1000 # Updated test images for new FreeType. gzip -dc %SOURCE1000 | tar xf - --transform='s~^mpl-images-%{mpl_images_version}-with-freetype-%{ftver}/~~' # Copy mplsetup.cfg to the builddir cp -p %{SOURCE1} mplsetup.cfg # Backports or reported upstream %autopatch -p1 -M 999 %generate_buildrequires %pyproject_buildrequires -r %build %set_build_flags export http_proxy=http://127.0.0.1/ MPLCONFIGDIR=$PWD %pyproject_wheel %if %{with_html} # Need to make built matplotlib libs available for the sphinx extensions: pushd doc MPLCONFIGDIR=$PWD/.. \ PYTHONPATH=`realpath ../build/lib.linux*` \ %{__python3} make.py html popd %endif # Ensure all example files are non-executable so that the -doc # package doesn't drag in dependencies find galleries -name '*.py' -exec chmod a-x '{}' \; %install export http_proxy=http://127.0.0.1/ MPLCONFIGDIR=$PWD %pyproject_install chmod +x %{buildroot}%{python3_sitearch}/matplotlib/dates.py mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_datadir}/matplotlib mv %{buildroot}%{python3_sitearch}/matplotlib/mpl-data \ %{buildroot}%{_datadir}/matplotlib ln -s %{_datadir}/matplotlib/mpl-data %{buildroot}%{python3_sitearch}/matplotlib/mpl-data %if !%{with_bundled_fonts} rm -rf %{buildroot}%{_datadir}/matplotlib/mpl-data/fonts %endif %if %{run_tests} %check # These files confuse pytest, and we want to test the installed copy. rm -rf build*/ export http_proxy=http://127.0.0.1/ # Skips: # * test_invisible_Line_rendering: Checks for "slowness" that often fails on a # heavily-loaded builder. # * wxagg is broken on ppc64le: # https://bugzilla.redhat.com/show_bug.cgi?id=1738752 MPLCONFIGDIR=$PWD \ MATPLOTLIBRC=%{buildroot}%{_datadir}/matplotlib/mpl-data/matplotlibrc \ PYTHONPATH=%{buildroot}%{python3_sitearch} \ PYTHONDONTWRITEBYTECODE=1 \ xvfb-run -a -s "-screen 0 640x480x24" \ %{__python3} tests.py -ra -n $(getconf _NPROCESSORS_ONLN) \ -m 'not network' \ -k 'not test_invisible_Line_rendering and not Qt5Agg' # Run Qt5Agg tests separately to not conflict with Qt4 tests. MPLCONFIGDIR=$PWD \ MATPLOTLIBRC=%{buildroot}%{_datadir}/matplotlib/mpl-data/matplotlibrc \ PYTHONPATH=%{buildroot}%{python3_sitearch} \ PYTHONDONTWRITEBYTECODE=1 \ xvfb-run -a -s "-screen 0 640x480x24" \ %{__python3} tests.py -ra -n $(getconf _NPROCESSORS_ONLN) \ -m 'not network' %endif %files -n python3-matplotlib-data %{_datadir}/matplotlib/mpl-data/ %if %{with_bundled_fonts} %exclude %{_datadir}/matplotlib/mpl-data/fonts/ %endif %if %{with_bundled_fonts} %files -n python3-matplotlib-data-fonts %{_datadir}/matplotlib/mpl-data/fonts/ %endif %files -n python3-matplotlib-doc %doc galleries/examples %if %{with_html} %doc doc/build/html/* %endif %files -n python3-matplotlib %license LICENSE/ %doc README.md %{python3_sitearch}/*dist-info %{python3_sitearch}/matplotlib/ %dir %{python3_sitearch}/matplotlib/backends %dir %{python3_sitearch}/matplotlib/backends/__pycache__ %exclude %{python3_sitearch}/matplotlib/tests/baseline_images/* %{python3_sitearch}/mpl_toolkits/ %exclude %{python3_sitearch}/mpl_toolkits/*/tests/baseline_images/* %{python3_sitearch}/pylab.py* %{python3_sitearch}/__pycache__/* %exclude %{python3_sitearch}/matplotlib/mpl-data %if "%{backend}" == "Qt5Agg" %exclude %{python3_sitearch}/matplotlib/backends/backend_qt5*.py %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/backend_qt5* %endif %exclude %{python3_sitearch}/matplotlib/backends/backend_gtk*.py %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/backend_gtk* %if "%{backend}" == "TkAgg" %exclude %{python3_sitearch}/matplotlib/backends/_backend_tk.py %exclude %{python3_sitearch}/matplotlib/backends/backend_tk*.py %exclude %{python3_sitearch}/matplotlib/backends/tkagg.py %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/_backend_tk.* %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/backend_tk*.* %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/tkagg.* %exclude %{python3_sitearch}/matplotlib/backends/_tkagg.* %endif %if "%{backend}" == "WXAgg" %exclude %{python3_sitearch}/matplotlib/backends/backend_wx* %exclude %{python3_sitearch}/matplotlib/backends/wx_compat.* %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/backend_wx* %exclude %{python3_sitearch}/matplotlib/backends/__pycache__/wx_compat.* %endif %files -n python3-matplotlib-test-data %{python3_sitearch}/matplotlib/tests/baseline_images/ %{python3_sitearch}/mpl_toolkits/*/tests/baseline_images/ %files -n python3-matplotlib-qt5 %{python3_sitearch}/matplotlib/backends/backend_qt5.* %{python3_sitearch}/matplotlib/backends/__pycache__/backend_qt5.* %{python3_sitearch}/matplotlib/backends/backend_qt5agg.* %{python3_sitearch}/matplotlib/backends/__pycache__/backend_qt5agg.* # This is handled by backend_qt*.py (no number), so the package exists only for # the dependencies. %files -n python3-matplotlib-qt6 %files -n python3-matplotlib-gtk3 %{python3_sitearch}/matplotlib/backends/backend_gtk*.py %{python3_sitearch}/matplotlib/backends/__pycache__/backend_gtk* %files -n python3-matplotlib-tk %{python3_sitearch}/matplotlib/backends/backend_tk*.py %{python3_sitearch}/matplotlib/backends/_backend_tk.py %{python3_sitearch}/matplotlib/backends/__pycache__/backend_tk*.* %{python3_sitearch}/matplotlib/backends/__pycache__/_backend_tk.* %{python3_sitearch}/matplotlib/backends/_tkagg.* %files -n python3-matplotlib-wx %{python3_sitearch}/matplotlib/backends/backend_wx*.py %{python3_sitearch}/matplotlib/backends/__pycache__/backend_wx*