4524214
%bcond_with html
4524214
%bcond_without check
4524214
# https://fedorahosted.org/fpc/ticket/381
4524214
%bcond_without bundled_fonts
2e2f0e7
Tomas Popela 4e3179c
# No WX for EL8/ELN/EL9
Tomas Popela 4e3179c
%if 0%{?rhel} >= 8
Tomas Popela 4e3179c
%bcond_with wx
Tomas Popela 4e3179c
%else
Tomas Popela 4e3179c
%bcond_without wx
Tomas Popela 4e3179c
%endif
Tomas Popela 4e3179c
8293bc2
# the default backend; one of GTK3Agg GTK3Cairo MacOSX Qt4Agg Qt5Agg TkAgg
8293bc2
# WXAgg Agg Cairo PS PDF SVG
7731b0f
%global backend                 TkAgg
7731b0f
732ad8b
%if "%{backend}" == "TkAgg"
732ad8b
%global backend_subpackage tk
732ad8b
%else
befe1f6
%  if "%{backend}" == "Qt5Agg"
732ad8b
%global backend_subpackage qt5
befe1f6
%  else
befe1f6
%    if "%{backend}" == "WXAgg"
6995ee3
%global backend_subpackage wx
732ad8b
%    endif
732ad8b
%  endif
732ad8b
%endif
732ad8b
8c9cc20
# Use the same directory of the main package for subpackage licence and docs
8c9cc20
%global _docdir_fmt %{name}
8c9cc20
f171297
# Updated test images for new FreeType.
c30bc8d
%global mpl_images_version 3.6.0
f171297
1584487
# The version of FreeType in this Fedora branch.
d955e87
%global ftver 2.12.1
1584487
25f5d42
Name:           python-matplotlib
c30bc8d
Version:        3.6.0
c30bc8d
%global Version 3.6.0
0c4b36d
Release:        %autorelease
cfeed65
Summary:        Python 2D plotting library
209ed58
# qt_editor backend is MIT
c24355d
# ResizeObserver at end of lib/matplotlib/backends/web_backend/js/mpl.js is Public Domain
c24355d
License:        Python and MIT and Public Domain
cfeed65
URL:            http://matplotlib.org
704b8e1
Source0:        %pypi_source matplotlib %{Version}
569a4dd
Source1:        mplsetup.cfg
cfeed65
1584487
# Fedora-specific patches; see:
120f1b7
# https://github.com/fedora-python/matplotlib/tree/fedora-patches
1584487
# Updated test images for new FreeType.
f171297
Source1000:     https://github.com/QuLogic/mpl-images/archive/v%{mpl_images_version}-with-freetype-%{ftver}/matplotlib-%{mpl_images_version}-with-freetype-%{ftver}.tar.gz
1584487
# Search in /etc/matplotlibrc:
1584487
Patch1001:      0001-matplotlibrc-path-search-fix.patch
9046bbb
# Increase tolerances for new FreeType everywhere:
e6f3591
Patch1002:      0002-Set-FreeType-version-to-%{ftver}-and-update-tolerances.patch
f97a7a2
Patch1003:      0003-Increase-a-few-test-tolerances-on-some-arches.patch
037e6ae
704b8e1
# https://github.com/matplotlib/matplotlib/pull/21190#issuecomment-1223271888
8b94e4a
Patch0001:      0004-Use-old-stride_windows-implementation-on-32-bit-x86.patch
36d9ebc
ee42f59
BuildRequires:  gcc
ee42f59
BuildRequires:  gcc-c++
685e53f
BuildRequires:  glibc-langpack-en
cfeed65
BuildRequires:  freetype-devel
cfeed65
BuildRequires:  libpng-devel
dd3b8ab
BuildRequires:  qhull-devel
f2d3f53
BuildRequires:  xorg-x11-server-Xvfb
cfeed65
BuildRequires:  zlib-devel
Thomas Spura a0ff1b7
9d428b0
BuildRequires:  ghostscript
Tomas Popela c4148f5
# No ImageMagick for EL8/ELN/EL9
4dfd2f1
%if 0%{?fedora} || (0%{?rhel} && 0%{?rhel} < 8)
9d428b0
BuildRequires:  ImageMagick
Tomas Popela c4148f5
%endif
c7c1d89
%ifnarch s390x
9d428b0
BuildRequires:  inkscape
c7c1d89
%endif
9d428b0
704b8e1
BuildRequires:  font(dejavusans)
704b8e1
BuildRequires:  font(notosanscjkjp)
704b8e1
BuildRequires:  font(wenquanyizenhei)
704b8e1
15d6bc1
BuildRequires:  texlive-collection-basic
15d6bc1
BuildRequires:  texlive-collection-fontsrecommended
15d6bc1
BuildRequires:  texlive-collection-latex
15d6bc1
BuildRequires:  texlive-collection-latexrecommended
9d428b0
BuildRequires:  texlive-dvipng
02546b2
BuildRequires:  texlive-latex-bin
15d6bc1
BuildRequires:  texlive-luahbtex
02546b2
BuildRequires:  texlive-tex-bin
02546b2
BuildRequires:  texlive-xetex-bin
02546b2
# Search for documentclass and add the classes here.
02546b2
BuildRequires:  tex(article.cls)
02546b2
# Search for inputenc and add any encodings used with it.
02546b2
BuildRequires:  tex(utf8.def)
107b5a1
BuildRequires:  tex(utf8x.def)
02546b2
# Found with: rg -Io 'usepackage(\[.+\])?\{.+\}' lib | rg -o '\{.+\}' | sort -u
02546b2
# and then removing duplicates in one line, etc.
f5b673f
BuildRequires:  tex(avant.sty)
107b5a1
BuildRequires:  tex(chancery.sty)
107b5a1
BuildRequires:  tex(charter.sty)
0c4b36d
BuildRequires:  tex(chemformula.sty)
02546b2
BuildRequires:  tex(color.sty)
f5b673f
BuildRequires:  tex(courier.sty)
02546b2
BuildRequires:  tex(fontenc.sty)
02546b2
BuildRequires:  tex(fontspec.sty)
f5b673f
BuildRequires:  tex(geometry.sty)
02546b2
BuildRequires:  tex(graphicx.sty)
f5b673f
BuildRequires:  tex(helvet.sty)
704b8e1
BuildRequires:  tex(hyperref.sty)
02546b2
BuildRequires:  tex(import.sty)
f5b673f
BuildRequires:  tex(inputenc.sty)
704b8e1
BuildRequires:  tex(lmodern.sty)
f5b673f
BuildRequires:  tex(mathpazo.sty)
f5b673f
BuildRequires:  tex(mathptmx.sty)
02546b2
BuildRequires:  tex(pgf.sty)
f5b673f
BuildRequires:  tex(sfmath.sty)
f5b673f
BuildRequires:  tex(textcomp.sty)
f5b673f
BuildRequires:  tex(txfonts.sty)
02546b2
BuildRequires:  tex(type1cm.sty)
f5b673f
BuildRequires:  tex(type1ec.sty)
704b8e1
BuildRequires:  tex(underscore.sty)
02546b2
# See BakomaFonts._fontmap in lib/matplotlib/mathtext.py
02546b2
BuildRequires:  tex(cmb10.tfm)
02546b2
BuildRequires:  tex(cmex10.tfm)
02546b2
BuildRequires:  tex(cmmi10.tfm)
02546b2
BuildRequires:  tex(cmr10.tfm)
107b5a1
BuildRequires:  tex(cmss10.tfm)
02546b2
BuildRequires:  tex(cmsy10.tfm)
02546b2
BuildRequires:  tex(cmtt10.tfm)
f5b673f
Thomas Spura a0ff1b7
%description
e6f3591
Matplotlib is a Python 2D plotting library which produces publication
Thomas Spura a0ff1b7
quality figures in a variety of hardcopy formats and interactive
e6f3591
environments across platforms. Matplotlib can be used in Python
e6f3591
scripts, the Python and IPython shell, web application servers, and
e6f3591
various graphical user interface toolkits.
Thomas Spura a0ff1b7
Thomas Spura a0ff1b7
Matplotlib tries to make easy things easy and hard things possible.
Thomas Spura a0ff1b7
You can generate plots, histograms, power spectra, bar charts,
Thomas Spura a0ff1b7
errorcharts, scatterplots, etc, with just a few lines of code.
Thomas Spura a0ff1b7
b4eba4a
%package -n python3-matplotlib-data
12e8a62
Summary:        Data used by python-matplotlib
Dominik 'Rathann' Mierzejewski b295321
BuildArch:      noarch
4524214
%if %{with bundled_fonts}
b4eba4a
Requires:       python3-matplotlib-data-fonts = %{version}-%{release}
12e8a62
%endif
831ec4c
Obsoletes:      python-matplotlib-data < 3
12e8a62
b4eba4a
%description -n python3-matplotlib-data
12e8a62
%{summary}
12e8a62
4524214
%if %{with bundled_fonts}
b4eba4a
%package -n python3-matplotlib-data-fonts
12e8a62
Summary:        Fonts used by python-matplotlib
7901631
# STIX and Computer Modern is OFL
7901631
# DejaVu is Bitstream Vera and Public Domain
7901631
License:        OFL and Bitstream Vera and Public Domain
12e8a62
BuildArch:      noarch
b4eba4a
Requires:       python3-matplotlib-data = %{version}-%{release}
831ec4c
Obsoletes:      python-matplotlib-data-fonts < 3
12e8a62
b4eba4a
%description -n python3-matplotlib-data-fonts
12e8a62
%{summary}
12e8a62
%endif
12e8a62
cfeed65
%package -n     python3-matplotlib
cfeed65
Summary:        Python 2D plotting library
cfeed65
BuildRequires:  python3-devel
8e6d614
BuildRequires:  python3-cairo
cfeed65
BuildRequires:  python3-gobject
cfeed65
BuildRequires:  python3-pytz
1584487
BuildRequires:  python3-sphinx
Dominik 'Rathann' Mierzejewski b295321
Requires:       dejavu-sans-fonts
713ad40
Recommends:     texlive-dvipng
713ad40
Requires:       (texlive-dvipng if texlive-base)
b4eba4a
Requires:       python3-matplotlib-data = %{version}-%{release}
cfeed65
Requires:       python3-cairo
Dominik 'Rathann' Mierzejewski b295321
Requires:       python3-matplotlib-%{?backend_subpackage}%{!?backend_subpackage:tk}%{?_isa} = %{version}-%{release}
4524214
%if %{with check}
5ff9cbe
BuildRequires:  python3-pytest
1f37c6a
BuildRequires:  python3-pytest-rerunfailures
1f37c6a
BuildRequires:  python3-pytest-timeout
ad961d5
BuildRequires:  python3-pytest-xdist
037e6ae
BuildRequires:  python3-pikepdf
Dominik 'Rathann' Mierzejewski b295321
%endif
4524214
%if %{without bundled_fonts}
Thomas Spura a9a2c96
Requires:       stix-math-fonts
ab00be2
%else
Dominik 'Rathann' Mierzejewski b295321
Provides:       bundled(stix-math-fonts)
Dominik 'Rathann' Mierzejewski b295321
%endif
cfeed65
cfeed65
%description -n python3-matplotlib
e6f3591
Matplotlib is a Python 2D plotting library which produces publication
cfeed65
quality figures in a variety of hardcopy formats and interactive
e6f3591
environments across platforms. Matplotlib can be used in Python
e6f3591
scripts, the Python and IPython shell, web application servers, and
e6f3591
various graphical user interface toolkits.
cfeed65
cfeed65
Matplotlib tries to make easy things easy and hard things possible.
cfeed65
You can generate plots, histograms, power spectra, bar charts,
cfeed65
errorcharts, scatterplots, etc, with just a few lines of code.
cfeed65
dd3b8ab
%package -n     python3-matplotlib-qt5
dd3b8ab
Summary:        Qt5 backend for python3-matplotlib
dd3b8ab
BuildRequires:  python3-qt5
Dominik 'Rathann' Mierzejewski b295321
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
dd3b8ab
Requires:       python3-qt5
befe1f6
Obsoletes:      python3-matplotlib-qt4 < 3.5.0-0
dd3b8ab
dd3b8ab
%description -n python3-matplotlib-qt5
dd3b8ab
%{summary}
dd3b8ab
9c2074e
%package -n     python3-matplotlib-gtk3
9c2074e
Summary:        GTK3 backend for python3-matplotlib
9c2074e
# This should be converted to typelib(Gtk) when supported
9c2074e
BuildRequires:  gtk3
9c2074e
BuildRequires:  python3-gobject
9c2074e
Requires:       gtk3%{?_isa}
9c2074e
Requires:       python3-gobject%{?_isa}
Dominik 'Rathann' Mierzejewski b295321
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
9c2074e
9c2074e
%description -n python3-matplotlib-gtk3
9c2074e
%{summary}
9c2074e
209ed58
%package -n     python3-matplotlib-gtk4
209ed58
Summary:        GTK4 backend for python3-matplotlib
209ed58
# This should be converted to typelib(Gtk) when supported
209ed58
BuildRequires:  gtk4
209ed58
BuildRequires:  python3-gobject
209ed58
Requires:       gtk4%{?_isa}
209ed58
Requires:       python3-gobject%{?_isa}
209ed58
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
209ed58
209ed58
%description -n python3-matplotlib-gtk4
209ed58
%{summary}
209ed58
cfeed65
%package -n     python3-matplotlib-tk
cfeed65
Summary:        Tk backend for python3-matplotlib
569a4dd
BuildRequires:  python3-pillow-tk
cfeed65
BuildRequires:  python3-tkinter
Dominik 'Rathann' Mierzejewski b295321
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
569a4dd
Requires:       python3-pillow-tk
cfeed65
Requires:       python3-tkinter
cfeed65
cfeed65
%description -n python3-matplotlib-tk
cfeed65
%{summary}
cfeed65
Tomas Popela 4e3179c
%if %{with wx}
6995ee3
%package -n     python3-matplotlib-wx
6995ee3
Summary:        WX backend for python3-matplotlib
6995ee3
BuildRequires:  python3-wxpython4
6995ee3
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
6995ee3
Requires:       python3-wxpython4
6995ee3
6995ee3
%description -n python3-matplotlib-wx
6995ee3
%{summary}
Tomas Popela 4e3179c
%endif
6995ee3
8293bc2
%package -n python3-matplotlib-doc
8293bc2
Summary:        Documentation files for python-matplotlib
4524214
%if %{with html}
8293bc2
BuildRequires:  graphviz
8e6d614
BuildRequires:  make
8293bc2
BuildRequires:  python3-sphinx
8293bc2
BuildRequires:  tex(latex)
8293bc2
BuildRequires:  tex-preview
8293bc2
%endif
8293bc2
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
8293bc2
8293bc2
%description -n python3-matplotlib-doc
8293bc2
%{summary}
8293bc2
c48ca2e
%package -n python3-matplotlib-test-data
c48ca2e
Summary:        Test data for python3-matplotlib
c48ca2e
Requires:       python3-matplotlib%{?_isa} = %{version}-%{release}
c48ca2e
c48ca2e
%description -n python3-matplotlib-test-data
c48ca2e
%{summary}
c48ca2e
c48ca2e
25f5d42
%prep
037e6ae
%autosetup -n matplotlib-%{Version} -N
f171297
14e8645
# Fedora-specific patches follow:
3f6380d
%patch1001 -p1
1584487
# Updated test images for new FreeType.
9046bbb
%patch1002 -p1
037e6ae
gzip -dc %SOURCE1000 | tar xf - --transform='s~^mpl-images-%{mpl_images_version}-with-freetype-%{ftver}/\([^/]\+\)/~lib/\1/tests/baseline_images/~'
ca0fc90
569a4dd
# Copy mplsetup.cfg to the builddir
569a4dd
cp -p %{SOURCE1} mplsetup.cfg
Thomas Spura be26c9b
794ddb8
%patch1003 -p1
8e6d614
704b8e1
# Backports or reported upstream
36d9ebc
%patch0001 -p1
36d9ebc
8e6d614
8e6d614
%generate_buildrequires
8e6d614
%pyproject_buildrequires -r
794ddb8
267dd5c
25f5d42
%build
6e771d1
%set_build_flags
Dominik 'Rathann' Mierzejewski b295321
export http_proxy=http://127.0.0.1/
8293bc2
8e6d614
MPLCONFIGDIR=$PWD %pyproject_wheel
4524214
%if %{with html}
cfeed65
# Need to make built matplotlib libs available for the sphinx extensions:
8e6d614
MPLCONFIGDIR=$PWD \
704b8e1
PYTHONPATH="%{pyprojec_site_lib}" \
8e6d614
    make -C doc html
a706a1d
%endif
cfeed65
# Ensure all example files are non-executable so that the -doc
cfeed65
# package doesn't drag in dependencies
664c62f
find examples -name '*.py' -exec chmod a-x '{}' \;
664c62f
4524214
25f5d42
%install
Dominik 'Rathann' Mierzejewski b295321
export http_proxy=http://127.0.0.1/
8293bc2
8e6d614
MPLCONFIGDIR=$PWD %pyproject_install
ca0fc90
ca0fc90
# Delete unnecessary files.
ca0fc90
rm %{buildroot}%{python3_sitearch}/matplotlib/backends/web_backend/.{eslintrc.js,prettierignore,prettierrc}
ca0fc90
rm %{buildroot}%{python3_sitearch}/matplotlib/tests/tinypages/.gitignore
ca0fc90
rm %{buildroot}%{python3_sitearch}/matplotlib/tests/tinypages/_static/.gitignore
ca0fc90
ca0fc90
# Move files to Fedora-specific locations.
b9a2f55
mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_datadir}/matplotlib
8293bc2
mv %{buildroot}%{python3_sitearch}/matplotlib/mpl-data \
b9a2f55
   %{buildroot}%{_datadir}/matplotlib
4524214
%if %{without bundled_fonts}
b9a2f55
rm -rf %{buildroot}%{_datadir}/matplotlib/mpl-data/fonts
12e8a62
%endif
25f5d42
4524214
4524214
%if %{with check}
Thomas Spura be26c9b
%check
5ff9cbe
# These files confuse pytest, and we want to test the installed copy.
5ff9cbe
rm -rf build*/
5ff9cbe
98cb5a1
# We need to prime this LaTeX cache stuff, or it might fail while running tests
98cb5a1
# in parallel.
4ed16b6
mktexfmt latex.fmt
98cb5a1
mktexfmt lualatex.fmt
98cb5a1
mktexfmt pdflatex.fmt
98cb5a1
mktexfmt xelatex.fmt
98cb5a1
Dominik 'Rathann' Mierzejewski b295321
export http_proxy=http://127.0.0.1/
b11ac26
# Skips:
c89bd06
#  * test_invisible_Line_rendering: Checks for "slowness" that often fails on a
c89bd06
#    heavily-loaded builder.
ee6d703
#  * test_form_widget_get_with_datetime_and_date_fields is flaky.
12e8a62
MPLCONFIGDIR=$PWD \
3d6adc1
%ifnarch %{ix86}
4cf6018
     xvfb-run -a -s "-screen 0 640x480x24" \
3d6adc1
%endif
8e6d614
         env %{pytest} -ra -n auto \
c89bd06
             -m 'not network' \
ee6d703
             -k 'not test_invisible_Line_rendering and not test_form_widget_get_with_datetime_and_date_fields' \
8e6d614
             --pyargs matplotlib mpl_toolkits.tests
6ae3a9e
%endif
Thomas Spura be26c9b
4524214
b4eba4a
%files -n python3-matplotlib-data
Dominik 'Rathann' Mierzejewski b295321
%{_datadir}/matplotlib/mpl-data/
4524214
%if %{with bundled_fonts}
Dominik 'Rathann' Mierzejewski b295321
%exclude %{_datadir}/matplotlib/mpl-data/fonts/
Dominik 'Rathann' Mierzejewski b295321
%endif
Dominik 'Rathann' Mierzejewski b295321
4524214
%if %{with bundled_fonts}
b4eba4a
%files -n python3-matplotlib-data-fonts
Dominik 'Rathann' Mierzejewski b295321
%{_datadir}/matplotlib/mpl-data/fonts/
Dominik 'Rathann' Mierzejewski b295321
%endif
Dominik 'Rathann' Mierzejewski b295321
8293bc2
%files -n python3-matplotlib-doc
838673b
%doc examples
4524214
%if %{with html}
cfeed65
%doc doc/build/html/*
cfeed65
%endif
cfeed65
cfeed65
%files -n python3-matplotlib
9411cfc
%license LICENSE/
1584487
%doc README.rst
8e6d614
%{python3_sitearch}/matplotlib-*.dist-info/
Thomas Spura 81fc2e8
%{python3_sitearch}/matplotlib-*-nspkg.pth
cfeed65
%{python3_sitearch}/matplotlib/
Dominik 'Rathann' Mierzejewski b295321
%exclude %{python3_sitearch}/matplotlib/tests/baseline_images/*
cfeed65
%{python3_sitearch}/mpl_toolkits/
Dominik 'Rathann' Mierzejewski b295321
%exclude %{python3_sitearch}/mpl_toolkits/tests/baseline_images/*
4524214
%pycached %{python3_sitearch}/pylab.py
Tomas Popela 4cdf22e
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_qt5*.py
4524214
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_gtk*.py
4524214
%pycached %exclude %{python3_sitearch}/matplotlib/backends/_backend_tk.py
4524214
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_tk*.py
cfeed65
%exclude %{python3_sitearch}/matplotlib/backends/_tkagg.*
4524214
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_wx*.py
14bebd4
%if %{with html}
8c9cc20
%exclude %{_pkgdocdir}/*/
14bebd4
%endif
cfeed65
c48ca2e
%files -n python3-matplotlib-test-data
c48ca2e
%{python3_sitearch}/matplotlib/tests/baseline_images/
c48ca2e
%{python3_sitearch}/mpl_toolkits/tests/baseline_images/
c48ca2e
dd3b8ab
%files -n python3-matplotlib-qt5
fab6d6a
%pycached %{python3_sitearch}/matplotlib/backends/backend_qt5*.py
dd3b8ab
9c2074e
%files -n python3-matplotlib-gtk3
209ed58
%pycached %{python3_sitearch}/matplotlib/backends/backend_gtk3*.py
209ed58
209ed58
%files -n python3-matplotlib-gtk4
209ed58
%pycached %{python3_sitearch}/matplotlib/backends/backend_gtk4*.py
9c2074e
cfeed65
%files -n python3-matplotlib-tk
4524214
%pycached %{python3_sitearch}/matplotlib/backends/backend_tk*.py
4524214
%pycached %{python3_sitearch}/matplotlib/backends/_backend_tk.py
cfeed65
%{python3_sitearch}/matplotlib/backends/_tkagg.*
644f5c0
Tomas Popela 4e3179c
%if %{with wx}
6995ee3
%files -n python3-matplotlib-wx
4524214
%pycached %{python3_sitearch}/matplotlib/backends/backend_wx*.py
Tomas Popela 4e3179c
%endif
6995ee3
a6c4a06
25f5d42
%changelog
9d2b54f
%autochangelog