Blame python-mplcairo.spec

cddae7d
%global srcname mplcairo
cddae7d
cddae7d
Name:           python-%{srcname}
cddae7d
Version:        0.1
cddae7d
Release:        1%{?dist}
cddae7d
Summary:        A (new) cairo backend for Matplotlib
cddae7d
cddae7d
License:        MIT
cddae7d
URL:            https://github.com/anntzer/mplcairo
cddae7d
Source0:        https://files.pythonhosted.org/packages/source/m/%{srcname}/%{srcname}-%{version}.tar.gz
cddae7d
# Fedora-specific patches.
cddae7d
Patch0001:      0001-Don-t-hardcode-march-native.patch
cddae7d
Patch0002:      0002-Remove-extra-requirements.patch
4308ea6
Patch0003:      0003-Try-to-fix-bool-snap-lifetimes.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
cddae7d
BuildRequires:  libraqm-devel >= 0.2.0
cddae7d
BuildRequires:  python3-devel
cddae7d
BuildRequires:  python3dist(matplotlib) >= 2.2
cddae7d
BuildRequires:  python3-matplotlib-test-data >= 2.2
cddae7d
BuildRequires:  python3dist(pybind11) >= 2.2.3
cddae7d
BuildRequires:  python3dist(pycairo) >= 1.16.0
cddae7d
BuildRequires:  python3dist(pytest) >= 3.2.2
cddae7d
BuildRequires:  python3dist(setuptools)
cddae7d
BuildRequires:  python3dist(setuptools-scm)
cddae7d
BuildRequires:  python3dist(sphinx)
cddae7d
BuildRequires:  texlive-cm
cddae7d
cddae7d
Requires:       cairo >= 1.15.4
cddae7d
Requires:       python3dist(matplotlib) >= 2.2
cddae7d
Requires:       python3dist(pycairo) >= 1.16.0
cddae7d
Requires:       libraqm >= 0.2.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
cddae7d
MPLCAIRO_USE_LIBRAQM=true %py3_build
cddae7d
cddae7d
cddae7d
%install
cddae7d
%py3_install
cddae7d
cddae7d
cddae7d
%check
cddae7d
export PYTHONPATH="%{buildroot}%{python3_sitearch}" PYTHONDONTWRITEBYTECODE=1
cddae7d
cddae7d
%{__python3} -c 'import mplcairo.base'
cddae7d
cddae7d
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.
cddae7d
%{__python3} run-mpl-test-suite.py --tolerance=50 -m 'not network' -v
cddae7d
cddae7d
cddae7d
%files -n python3-%{srcname}
cddae7d
%license LICENSE.txt
cddae7d
%doc README.rst
cddae7d
%{python3_sitearch}/%{srcname}
cddae7d
%{python3_sitearch}/%{srcname}.pth
cddae7d
%{python3_sitearch}/%{srcname}-%{version}-py?.?.egg-info
cddae7d
cddae7d
cddae7d
%changelog
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.