Blame python-mplcairo.spec

cddae7d
%global srcname mplcairo
cddae7d
cddae7d
Name:           python-%{srcname}
216d9a3
Version:        0.3
b594ccd
Release:        3%{?dist}
cddae7d
Summary:        A (new) cairo backend for Matplotlib
cddae7d
cddae7d
License:        MIT
b934dd9
URL:            https://github.com/matplotlib/mplcairo
b934dd9
Source0:        %pypi_source
58adf63
Patch0001:      https://github.com/matplotlib/mplcairo/commit/d2a95cad1f605c45d55d4a8aa64a546d2b96c93f.patch
cddae7d
cddae7d
BuildRequires:  gcc-c++
cddae7d
cddae7d
%description
cddae7d
This is a new, essentially complete implementation of a cairo backend for
cddae7d
Matplotlib. It can be used in combination with a Qt5, GTK3, Tk, wx, or macOS
cddae7d
UI, or noninteractively (i.e., to save figure to various file formats).
cddae7d
Noteworthy points include:
cddae7d
  - Improved accuracy (e.g., with marker positioning, quad meshes, and text
cddae7d
    kerning).
cddae7d
  - Support for a wider variety of font formats, such as otf and pfb, for vector
cddae7d
    (PDF, PS, SVG) backends (Matplotlib's Agg backend also supports such fonts).
cddae7d
  - Optional support for complex text layout (right-to-left languages, etc.)
cddae7d
    using Raqm.
cddae7d
  - Support for embedding URLs in PDF (but not SVG) output.
cddae7d
  - Support for multi-page output both for PDF and PS (Matplotlib only supports
cddae7d
    multi-page PDF).
cddae7d
  - Support for custom blend modes (see `examples/operators.py`).
cddae7d
cddae7d
cddae7d
%package -n     python3-%{srcname}
cddae7d
Summary:        %{summary}
cddae7d
%{?python_provide:%python_provide python3-%{srcname}}
cddae7d
cddae7d
BuildRequires:  cairo-devel >= 1.15.4
cddae7d
BuildRequires:  freetype-devel
216d9a3
BuildRequires:  libraqm-devel >= 0.7.0
cddae7d
BuildRequires:  python3-devel
cddae7d
BuildRequires:  python3dist(matplotlib) >= 2.2
cddae7d
BuildRequires:  python3-matplotlib-test-data >= 2.2
216d9a3
BuildRequires:  python3dist(pillow)
216d9a3
BuildRequires:  python3dist(pybind11) >= 2.5
4535819
BuildRequires:  python3dist(pycairo) >= 1.16
cddae7d
BuildRequires:  python3dist(pytest) >= 3.2.2
b934dd9
BuildRequires:  python3dist(pytest-xdist)
cddae7d
BuildRequires:  python3dist(setuptools)
cddae7d
BuildRequires:  python3dist(setuptools-scm)
cddae7d
BuildRequires:  python3dist(sphinx)
5258ea8
5258ea8
# LaTeX dependencies for tests, copied from python-matplotlib.
5258ea8
BuildRequires:  texlive-latex-bin
5258ea8
BuildRequires:  texlive-tex-bin
5258ea8
BuildRequires:  texlive-xetex-bin
5258ea8
# Search for documentclass and add the classes here.
5258ea8
BuildRequires:  tex(article.cls)
5258ea8
BuildRequires:  tex(minimal.cls)
5258ea8
# Search for inputenc and add any encodings used with it.
5258ea8
BuildRequires:  tex(utf8.def)
5258ea8
BuildRequires:  tex(utf8x.def)
5258ea8
# Found with: rg -Io 'usepackage(\[.+\])?\{.+\}' lib | rg -o '\{.+\}' | sort -u
5258ea8
# and then removing duplicates in one line, etc.
d578b17
BuildRequires:  tex(avant.sty)
5258ea8
BuildRequires:  tex(bm.sty)
5258ea8
BuildRequires:  tex(chancery.sty)
5258ea8
BuildRequires:  tex(charter.sty)
5258ea8
BuildRequires:  tex(color.sty)
d578b17
BuildRequires:  tex(courier.sty)
5258ea8
BuildRequires:  tex(euler.sty)
5258ea8
BuildRequires:  tex(fontenc.sty)
5258ea8
BuildRequires:  tex(fontspec.sty)
d578b17
BuildRequires:  tex(geometry.sty)
5258ea8
BuildRequires:  tex(graphicx.sty)
d578b17
BuildRequires:  tex(helvet.sty)
5258ea8
BuildRequires:  tex(import.sty)
d578b17
BuildRequires:  tex(inputenc.sty)
d578b17
BuildRequires:  tex(mathpazo.sty)
d578b17
BuildRequires:  tex(mathptmx.sty)
5258ea8
BuildRequires:  tex(pgf.sty)
d578b17
BuildRequires:  tex(preview.sty)
5258ea8
BuildRequires:  tex(psfrag.sty)
d578b17
BuildRequires:  tex(sfmath.sty)
d578b17
BuildRequires:  tex(textcomp.sty)
d578b17
BuildRequires:  tex(txfonts.sty)
d578b17
BuildRequires:  tex(type1cm.sty)
d578b17
BuildRequires:  tex(type1ec.sty)
5258ea8
BuildRequires:  tex(unicode-math.sty)
5258ea8
# See BakomaFonts._fontmap in lib/matplotlib/mathtext.py
5258ea8
BuildRequires:  tex(cmb10.tfm)
5258ea8
BuildRequires:  tex(cmex10.tfm)
5258ea8
BuildRequires:  tex(cmmi10.tfm)
5258ea8
BuildRequires:  tex(cmr10.tfm)
5258ea8
BuildRequires:  tex(cmss10.tfm)
5258ea8
BuildRequires:  tex(cmsy10.tfm)
5258ea8
BuildRequires:  tex(cmtt10.tfm)
cddae7d
cddae7d
Requires:       cairo >= 1.15.4
216d9a3
Requires:       libraqm >= 0.7.0
cddae7d
cddae7d
%description -n python3-%{srcname}
cddae7d
This is a new, essentially complete implementation of a cairo backend for
cddae7d
Matplotlib. It can be used in combination with a Qt5, GTK3, Tk, wx, or macOS
cddae7d
UI, or noninteractively (i.e., to save figure to various file formats).
cddae7d
Noteworthy points include:
cddae7d
  - Improved accuracy (e.g., with marker positioning, quad meshes, and text
cddae7d
    kerning).
cddae7d
  - Support for a wider variety of font formats, such as otf and pfb, for vector
cddae7d
    (PDF, PS, SVG) backends (Matplotlib's Agg backend also supports such fonts).
cddae7d
  - Optional support for complex text layout (right-to-left languages, etc.)
cddae7d
    using Raqm.
cddae7d
  - Support for embedding URLs in PDF (but not SVG) output.
cddae7d
  - Support for multi-page output both for PDF and PS (Matplotlib only supports
cddae7d
    multi-page PDF).
cddae7d
  - Support for custom blend modes (see `examples/operators.py`).
cddae7d
cddae7d
cddae7d
%prep
cddae7d
%autosetup -n %{srcname}-%{version} -p1
cddae7d
cddae7d
# Remove bundled egg-info and vendoring
cddae7d
rm -rf %{srcname}.egg-info vendor
cddae7d
cddae7d
cddae7d
%build
b934dd9
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
216d9a3
%py3_build
cddae7d
cddae7d
cddae7d
%install
b934dd9
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
cddae7d
%py3_install
cddae7d
cddae7d
cddae7d
%check
cddae7d
export PYTHONPATH="%{buildroot}%{python3_sitearch}" PYTHONDONTWRITEBYTECODE=1
cddae7d
6ad4efa
%{python3} -c 'import mplcairo.base'
cddae7d
6ad4efa
MPLBACKEND=module://mplcairo.base %{python3} - <
cddae7d
import matplotlib.pyplot as plt
cddae7d
print(plt.get_backend())
cddae7d
fig, ax = plt.subplots()
cddae7d
fig.savefig("/dev/null", format="png")
cddae7d
EOF
cddae7d
cddae7d
# 50 is upstream recommended tolerance since results won't match MPL exactly.
6ad4efa
%{python3} run-mpl-test-suite.py --tolerance=50 -m 'not network' -v -n auto
cddae7d
cddae7d
cddae7d
%files -n python3-%{srcname}
cddae7d
%license LICENSE.txt
cddae7d
%doc README.rst
cddae7d
%{python3_sitearch}/%{srcname}
cddae7d
%{python3_sitearch}/%{srcname}.pth
6ad4efa
%{python3_sitearch}/%{srcname}-%{version}-py%{python3_version}.egg-info
cddae7d
cddae7d
cddae7d
%changelog
b594ccd
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.3-3
b594ccd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
b594ccd
58adf63
* Thu Jul 02 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3-2
58adf63
- Backport fix for Matplotlib 3.3.0rc1
58adf63
b5fe4cd
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.3-2
b5fe4cd
- Rebuilt for Python 3.9
b5fe4cd
216d9a3
* Mon May 04 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3-1
216d9a3
- Update to latest version
216d9a3
abfc644
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2-2
abfc644
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
abfc644
b934dd9
* Mon Sep 23 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.2-1
b934dd9
- Update to latest version
b934dd9
c98d4be
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.1-4
c98d4be
- Rebuilt for Python 3.8
c98d4be
5d4d6b5
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-3
5d4d6b5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
5d4d6b5
272c891
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-2
272c891
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
272c891
cddae7d
* Mon Jul 23 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.1-1
cddae7d
- Update to final release
cddae7d
cddae7d
* Mon Apr 16 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.1-0.2.a1
cddae7d
- Remove bundled eggs.
cddae7d
- Add checks and missing Requires.
cddae7d
cddae7d
* Tue Mar 13 2018 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.1-0.1.a1
cddae7d
- Initial package.