python-matplotlib/python-matplotlib.spec

417 lines
13 KiB
RPMSpec
Raw Normal View History

2020-07-19 04:27:41 +00:00
%bcond_with html
%bcond_without check
# https://fedorahosted.org/fpc/ticket/381
%bcond_without bundled_fonts
# No WX for EL8/ELN/EL9
%if 0%{?rhel} >= 8
%bcond_with wx
%else
%bcond_without wx
%endif
2018-08-14 09:54:43 +00:00
# the default backend; one of GTK3Agg GTK3Cairo MacOSX Qt4Agg Qt5Agg TkAgg
# WXAgg Agg Cairo PS PDF SVG
2014-02-11 14:17:25 +00:00
%global backend TkAgg
2015-02-26 01:41:46 +00:00
%if "%{backend}" == "TkAgg"
%global backend_subpackage tk
%else
2021-08-21 01:22:02 +00:00
% if "%{backend}" == "Qt5Agg"
2015-02-26 01:41:46 +00:00
%global backend_subpackage qt5
2021-08-21 01:22:02 +00:00
% else
% if "%{backend}" == "WXAgg"
%global backend_subpackage wx
2015-02-26 01:41:46 +00:00
% endif
% endif
%endif
2015-02-25 04:07:46 +00:00
# Use the same directory of the main package for subpackage licence and docs
%global _docdir_fmt %{name}
2018-11-10 09:33:30 +00:00
# Updated test images for new FreeType.
2021-08-24 08:09:03 +00:00
%global mpl_images_version 3.5.0b1
2018-11-10 09:33:30 +00:00
2018-03-31 07:28:44 +00:00
# The version of FreeType in this Fedora branch.
%global ftver 2.11.0
2018-03-31 07:28:44 +00:00
Name: python-matplotlib
2021-08-24 08:09:03 +00:00
Version: 3.5.0
%global Version 3.5.0b1
Release: %autorelease -p b1
2012-11-27 20:01:54 +00:00
Summary: Python 2D plotting library
# qt4_editor backend is MIT
2020-11-12 06:35:38 +00:00
# ResizeObserver at end of lib/matplotlib/backends/web_backend/js/mpl.js is Public Domain
License: Python and MIT and Public Domain
2012-11-27 20:01:54 +00:00
URL: http://matplotlib.org
2020-06-30 00:38:52 +00:00
Source0: https://github.com/matplotlib/matplotlib/archive/v%{Version}/matplotlib-%{Version}.tar.gz
2021-08-24 08:09:03 +00:00
Source1: mplsetup.cfg
2012-11-27 20:01:54 +00:00
2018-03-31 07:28:44 +00:00
# Fedora-specific patches; see:
2019-04-23 10:17:43 +00:00
# https://github.com/fedora-python/matplotlib/tree/fedora-patches
2018-03-31 07:28:44 +00:00
# Updated test images for new FreeType.
2018-11-10 09:33:30 +00:00
Source1000: https://github.com/QuLogic/mpl-images/archive/v%{mpl_images_version}-with-freetype-%{ftver}/matplotlib-%{mpl_images_version}-with-freetype-%{ftver}.tar.gz
2018-03-31 07:28:44 +00:00
# Search in /etc/matplotlibrc:
Patch1001: 0001-matplotlibrc-path-search-fix.patch
2019-05-31 05:44:54 +00:00
# Increase tolerances for new FreeType everywhere:
2020-03-04 04:05:13 +00:00
Patch1002: 0002-Set-FreeType-version-to-%{ftver}-and-update-tolerances.patch
2021-08-13 05:56:55 +00:00
# Work around for problems with texlive 2021 (#1965547)
Patch1003: 0003-Slightly-increase-tolerance-on-rcupdate-test.patch
2021-08-24 08:09:03 +00:00
# https://github.com/matplotlib/matplotlib/pull/20884
Patch1004: 0004-Ensure-full-environment-is-passed-to-headless-test.patch
Patch1005: 0005-Increase-a-few-test-tolerances-on-some-arches.patch
2021-08-24 09:06:29 +00:00
# https://github.com/matplotlib/matplotlib/pull/20885
Patch1006: 0006-Fix-broken-QApplication-init-in-a-test.patch
2020-06-30 00:38:52 +00:00
2018-08-14 10:15:50 +00:00
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc-langpack-en
2012-11-27 20:01:54 +00:00
BuildRequires: freetype-devel
BuildRequires: libpng-devel
BuildRequires: qhull-devel
BuildRequires: xorg-x11-server-Xvfb
2012-11-27 20:01:54 +00:00
BuildRequires: zlib-devel
2020-06-30 09:42:19 +00:00
BuildRequires: ghostscript
# No ImageMagick for EL8/ELN/EL9
%if ! 0%{?rhel} >= 8
2020-06-30 09:42:19 +00:00
BuildRequires: ImageMagick
%endif
%ifnarch s390x
2020-06-30 09:42:19 +00:00
BuildRequires: inkscape
%endif
2020-06-30 09:42:19 +00:00
BuildRequires: texlive-collection-basic
BuildRequires: texlive-collection-fontsrecommended
BuildRequires: texlive-collection-latex
BuildRequires: texlive-collection-latexrecommended
2020-06-30 09:42:19 +00:00
BuildRequires: texlive-dvipng
BuildRequires: texlive-latex-bin
BuildRequires: texlive-luahbtex
BuildRequires: texlive-tex-bin
BuildRequires: texlive-xetex-bin
# Search for documentclass and add the classes here.
BuildRequires: tex(article.cls)
BuildRequires: tex(minimal.cls)
# Search for inputenc and add any encodings used with it.
BuildRequires: tex(utf8.def)
BuildRequires: tex(utf8x.def)
# Found with: rg -Io 'usepackage(\[.+\])?\{.+\}' lib | rg -o '\{.+\}' | sort -u
# and then removing duplicates in one line, etc.
2020-05-21 13:04:31 +00:00
BuildRequires: tex(avant.sty)
BuildRequires: tex(bm.sty)
BuildRequires: tex(chancery.sty)
BuildRequires: tex(charter.sty)
BuildRequires: tex(color.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(courier.sty)
BuildRequires: tex(euler.sty)
BuildRequires: tex(fancyhdr.sty)
BuildRequires: tex(fontenc.sty)
BuildRequires: tex(fontspec.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(geometry.sty)
BuildRequires: tex(graphicx.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(helvet.sty)
BuildRequires: tex(import.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(inputenc.sty)
BuildRequires: tex(mathpazo.sty)
BuildRequires: tex(mathptmx.sty)
BuildRequires: tex(pgf.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(preview.sty)
BuildRequires: tex(psfrag.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(sfmath.sty)
BuildRequires: tex(textcomp.sty)
BuildRequires: tex(txfonts.sty)
BuildRequires: tex(type1cm.sty)
2020-05-21 13:04:31 +00:00
BuildRequires: tex(type1ec.sty)
BuildRequires: tex(unicode-math.sty)
# See BakomaFonts._fontmap in lib/matplotlib/mathtext.py
BuildRequires: tex(cmb10.tfm)
BuildRequires: tex(cmex10.tfm)
BuildRequires: tex(cmmi10.tfm)
BuildRequires: tex(cmr10.tfm)
BuildRequires: tex(cmss10.tfm)
BuildRequires: tex(cmsy10.tfm)
BuildRequires: tex(cmtt10.tfm)
2020-05-21 13:04:31 +00:00
%description
2020-03-04 04:05:13 +00:00
Matplotlib is a Python 2D plotting library which produces publication
quality figures in a variety of hardcopy formats and interactive
2020-03-04 04:05:13 +00:00
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
2020-07-19 04:27:41 +00:00
%if %{with bundled_fonts}
Requires: python3-matplotlib-data-fonts = %{version}-%{release}
%endif
Obsoletes: python-matplotlib-data < 3
%description -n python3-matplotlib-data
%{summary}
2020-07-19 04:27:41 +00:00
%if %{with bundled_fonts}
%package -n python3-matplotlib-data-fonts
Summary: Fonts used by python-matplotlib
2018-09-21 08:25:34 +00:00
# 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}
Obsoletes: python-matplotlib-data-fonts < 3
%description -n python3-matplotlib-data-fonts
%{summary}
%endif
2012-11-27 20:01:54 +00:00
%package -n python3-matplotlib
Summary: Python 2D plotting library
BuildRequires: python3-devel
2021-08-21 06:23:28 +00:00
BuildRequires: python3-cairo
2012-11-27 20:01:54 +00:00
BuildRequires: python3-gobject
BuildRequires: python3-pytz
2018-03-31 07:28:44 +00:00
BuildRequires: python3-sphinx
Requires: dejavu-sans-fonts
Recommends: texlive-dvipng
Requires: (texlive-dvipng if texlive-base)
Requires: python3-matplotlib-data = %{version}-%{release}
2012-11-27 20:01:54 +00:00
Requires: python3-cairo
Requires: python3-matplotlib-%{?backend_subpackage}%{!?backend_subpackage:tk}%{?_isa} = %{version}-%{release}
2020-07-19 04:27:41 +00:00
%if %{with check}
2017-09-27 05:29:13 +00:00
BuildRequires: python3-pytest
2019-11-23 01:10:32 +00:00
BuildRequires: python3-pytest-rerunfailures
BuildRequires: python3-pytest-timeout
2018-03-13 20:43:27 +00:00
BuildRequires: python3-pytest-xdist
2020-06-30 00:38:52 +00:00
BuildRequires: python3-pikepdf
%endif
2020-07-19 04:27:41 +00:00
%if %{without bundled_fonts}
2015-11-15 13:16:29 +00:00
Requires: stix-math-fonts
%else
Provides: bundled(stix-math-fonts)
%endif
2012-11-27 20:01:54 +00:00
%description -n python3-matplotlib
2020-03-04 04:05:13 +00:00
Matplotlib is a Python 2D plotting library which produces publication
2012-11-27 20:01:54 +00:00
quality figures in a variety of hardcopy formats and interactive
2020-03-04 04:05:13 +00:00
environments across platforms. Matplotlib can be used in Python
scripts, the Python and IPython shell, web application servers, and
various graphical user interface toolkits.
2012-11-27 20:01:54 +00:00
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
BuildRequires: python3-qt5
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
Requires: python3-qt5
2021-08-21 01:22:02 +00:00
Obsoletes: python3-matplotlib-qt4 < 3.5.0-0
%description -n python3-matplotlib-qt5
%{summary}
2015-02-26 02:33:05 +00:00
%package -n python3-matplotlib-gtk3
Summary: GTK3 backend for python3-matplotlib
# This should be converted to typelib(Gtk) when supported
BuildRequires: gtk3
BuildRequires: python3-gobject
Requires: gtk3%{?_isa}
Requires: python3-gobject%{?_isa}
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
2015-02-26 02:33:05 +00:00
%description -n python3-matplotlib-gtk3
%{summary}
2012-11-27 20:01:54 +00:00
%package -n python3-matplotlib-tk
Summary: Tk backend for python3-matplotlib
2021-08-24 08:09:03 +00:00
BuildRequires: python3-pillow-tk
2012-11-27 20:01:54 +00:00
BuildRequires: python3-tkinter
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
2021-08-24 08:09:03 +00:00
Requires: python3-pillow-tk
2012-11-27 20:01:54 +00:00
Requires: python3-tkinter
%description -n python3-matplotlib-tk
%{summary}
%if %{with wx}
%package -n python3-matplotlib-wx
Summary: WX backend for python3-matplotlib
BuildRequires: python3-wxpython4
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
Requires: python3-wxpython4
%description -n python3-matplotlib-wx
%{summary}
%endif
2018-08-14 09:54:43 +00:00
%package -n python3-matplotlib-doc
Summary: Documentation files for python-matplotlib
2020-07-19 04:27:41 +00:00
%if %{with html}
2018-08-14 09:54:43 +00:00
BuildRequires: graphviz
2021-08-21 06:23:28 +00:00
BuildRequires: make
2018-08-14 09:54:43 +00:00
BuildRequires: python3-sphinx
BuildRequires: tex(latex)
BuildRequires: tex-preview
%endif
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
%description -n python3-matplotlib-doc
%{summary}
%package -n python3-matplotlib-test-data
Summary: Test data for python3-matplotlib
Requires: python3-matplotlib%{?_isa} = %{version}-%{release}
%description -n python3-matplotlib-test-data
%{summary}
%prep
2020-06-30 00:38:52 +00:00
%autosetup -n matplotlib-%{Version} -N
2018-11-10 09:33:30 +00:00
2018-01-24 09:27:51 +00:00
# Fedora-specific patches follow:
%patch1001 -p1
2018-03-31 07:28:44 +00:00
# Updated test images for new FreeType.
2019-05-31 05:44:54 +00:00
%patch1002 -p1
2020-06-30 00:38:52 +00:00
gzip -dc %SOURCE1000 | tar xf - --transform='s~^mpl-images-%{mpl_images_version}-with-freetype-%{ftver}/\([^/]\+\)/~lib/\1/tests/baseline_images/~'
2021-02-19 10:46:28 +00:00
2021-08-24 08:09:03 +00:00
# Copy mplsetup.cfg to the builddir
cp -p %{SOURCE1} mplsetup.cfg
%patch1003 -p1
2021-08-21 06:23:28 +00:00
%patch1004 -p1
%patch1005 -p1
2021-08-24 09:06:29 +00:00
%patch1006 -p1
2021-08-21 06:23:28 +00:00
%generate_buildrequires
%pyproject_buildrequires -r
%build
%set_build_flags
export http_proxy=http://127.0.0.1/
2018-08-14 09:54:43 +00:00
2021-08-21 06:23:28 +00:00
MPLCONFIGDIR=$PWD %pyproject_wheel
2020-07-19 04:27:41 +00:00
%if %{with html}
2012-11-27 20:01:54 +00:00
# Need to make built matplotlib libs available for the sphinx extensions:
2021-08-21 06:23:28 +00:00
MPLCONFIGDIR=$PWD \
PYTHONPATH=$(ls -d %{_pyproject_builddir}/pip-req-build-*/build/lib.%{python3_platform}-%{python3_version}) \
make -C doc html
%endif
2012-11-27 20:01:54 +00:00
# Ensure all example files are non-executable so that the -doc
# package doesn't drag in dependencies
2011-02-26 15:54:02 +00:00
find examples -name '*.py' -exec chmod a-x '{}' \;
2020-07-19 04:27:41 +00:00
%install
export http_proxy=http://127.0.0.1/
2018-08-14 09:54:43 +00:00
2021-08-21 06:23:28 +00:00
MPLCONFIGDIR=$PWD %pyproject_install
2021-02-19 10:46:28 +00:00
# Delete unnecessary files.
rm %{buildroot}%{python3_sitearch}/matplotlib/backends/web_backend/.{eslintrc.js,prettierignore,prettierrc}
rm %{buildroot}%{python3_sitearch}/matplotlib/tests/tinypages/.gitignore
rm %{buildroot}%{python3_sitearch}/matplotlib/tests/tinypages/_static/.gitignore
# Move files to Fedora-specific locations.
2015-02-26 04:26:38 +00:00
mkdir -p %{buildroot}%{_sysconfdir} %{buildroot}%{_datadir}/matplotlib
2018-08-14 09:54:43 +00:00
mv %{buildroot}%{python3_sitearch}/matplotlib/mpl-data \
2015-02-26 04:26:38 +00:00
%{buildroot}%{_datadir}/matplotlib
2020-07-19 04:27:41 +00:00
%if %{without bundled_fonts}
2015-02-26 04:26:38 +00:00
rm -rf %{buildroot}%{_datadir}/matplotlib/mpl-data/fonts
%endif
2020-07-19 04:27:41 +00:00
%if %{with check}
%check
2017-09-27 05:29:13 +00:00
# These files confuse pytest, and we want to test the installed copy.
rm -rf build*/
# We need to prime this LaTeX cache stuff, or it might fail while running tests
# in parallel.
2021-02-19 22:00:18 +00:00
mktexfmt latex.fmt
mktexfmt lualatex.fmt
mktexfmt pdflatex.fmt
mktexfmt xelatex.fmt
export http_proxy=http://127.0.0.1/
# Skips:
2018-04-01 00:08:43 +00:00
# * test_invisible_Line_rendering: Checks for "slowness" that often fails on a
# heavily-loaded builder.
MPLCONFIGDIR=$PWD \
xvfb-run -a -s "-screen 0 640x480x24" \
2021-08-21 06:23:28 +00:00
env %{pytest} -ra -n auto \
2018-04-01 00:08:43 +00:00
-m 'not network' \
2021-08-24 08:09:03 +00:00
-k 'not test_invisible_Line_rendering' \
2021-08-21 06:23:28 +00:00
--pyargs matplotlib mpl_toolkits.tests
%endif
2020-07-19 04:27:41 +00:00
%files -n python3-matplotlib-data
%{_datadir}/matplotlib/mpl-data/
2020-07-19 04:27:41 +00:00
%if %{with bundled_fonts}
%exclude %{_datadir}/matplotlib/mpl-data/fonts/
%endif
2020-07-19 04:27:41 +00:00
%if %{with bundled_fonts}
%files -n python3-matplotlib-data-fonts
%{_datadir}/matplotlib/mpl-data/fonts/
%endif
2018-08-14 09:54:43 +00:00
%files -n python3-matplotlib-doc
%doc examples
2020-07-19 04:27:41 +00:00
%if %{with html}
2012-11-27 20:01:54 +00:00
%doc doc/build/html/*
%endif
%files -n python3-matplotlib
%license LICENSE/
2018-03-31 07:28:44 +00:00
%doc README.rst
2021-08-21 06:23:28 +00:00
%{python3_sitearch}/matplotlib-*.dist-info/
%{python3_sitearch}/matplotlib-*-nspkg.pth
2012-11-27 20:01:54 +00:00
%{python3_sitearch}/matplotlib/
%exclude %{python3_sitearch}/matplotlib/tests/baseline_images/*
2012-11-27 20:01:54 +00:00
%{python3_sitearch}/mpl_toolkits/
%exclude %{python3_sitearch}/mpl_toolkits/tests/baseline_images/*
2020-07-19 04:27:41 +00:00
%pycached %{python3_sitearch}/pylab.py
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_qt4*.py
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_qt5*.py
2020-07-19 04:27:41 +00:00
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_gtk*.py
%pycached %exclude %{python3_sitearch}/matplotlib/backends/_backend_tk.py
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_tk*.py
2012-11-27 20:01:54 +00:00
%exclude %{python3_sitearch}/matplotlib/backends/_tkagg.*
2020-07-19 04:27:41 +00:00
%pycached %exclude %{python3_sitearch}/matplotlib/backends/backend_wx*.py
2015-02-25 04:07:46 +00:00
%exclude %{_pkgdocdir}/*/
2012-11-27 20:01:54 +00:00
%files -n python3-matplotlib-test-data
%{python3_sitearch}/matplotlib/tests/baseline_images/
%{python3_sitearch}/mpl_toolkits/tests/baseline_images/
%files -n python3-matplotlib-qt5
%pycached %{python3_sitearch}/matplotlib/backends/backend_qt5.py
%pycached %{python3_sitearch}/matplotlib/backends/backend_qt5agg.py
2015-02-26 02:33:05 +00:00
%files -n python3-matplotlib-gtk3
2020-07-19 04:27:41 +00:00
%pycached %{python3_sitearch}/matplotlib/backends/backend_gtk*.py
2015-02-26 02:33:05 +00:00
2012-11-27 20:01:54 +00:00
%files -n python3-matplotlib-tk
2020-07-19 04:27:41 +00:00
%pycached %{python3_sitearch}/matplotlib/backends/backend_tk*.py
%pycached %{python3_sitearch}/matplotlib/backends/_backend_tk.py
2012-11-27 20:01:54 +00:00
%{python3_sitearch}/matplotlib/backends/_tkagg.*
2006-07-03 21:30:23 +00:00
%if %{with wx}
%files -n python3-matplotlib-wx
2020-07-19 04:27:41 +00:00
%pycached %{python3_sitearch}/matplotlib/backends/backend_wx*.py
%endif
2018-08-14 01:27:10 +00:00
%changelog
2021-08-13 04:32:59 +00:00
%autochangelog