File python2-CairoSVG.spec of Package python2-CairoSVG
#
# spec file for package python2-CairoSVG
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
%bcond_without test
Name: python2-CairoSVG
Version: 1.0.22
Release: 0
License: LGPL-3.0+
Summary: A Simple SVG Converter for Cairo
Url: http://www.cairosvg.org/
Group: Development/Languages/Python
Source: http://files.pythonhosted.org/packages/source/C/CairoSVG/CairoSVG-%{version}.tar.gz
BuildRequires: python-Pillow
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: python-cairocffi
BuildRequires: python-lxml
BuildRequires: python-cssselect
BuildRequires: python-tinycss
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if %{with test}
BuildRequires: python-nose
%endif
Requires: python-Pillow
Requires: python-cairocffi
Requires: python-lxml
Requires: python-cssselect
Requires: python-tinycss
Provides: python-CairoSVG = %{version}
Obsoletes: python-CairoSVG < %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%description
CairoSVG is a SVG converter based on Cairo. It can export SVG files to PDF,
PostScript and PNG files.
For further information, please visit the CairoSVG Website http://www.cairosvg.org.
%prep
%setup -q -n CairoSVG-%{version}
%build
%python2_build
%install
%python2_install
%fdupes %{buildroot}%{python2_sitelib}
mv %{buildroot}/%{_bindir}/cairosvg %{buildroot}/%{_bindir}/cairosvg-%{python2_bin_suffix}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/cairosvg %{buildroot}%{_bindir}/cairosvg
%post
update-alternatives --install \
%{_bindir}/cairosvg cairosvg %{_bindir}/cairosvg-%{python2_bin_suffix} %{python2_version_nodots}
%postun
if [ ! -f %{_bindir}/cairosvg-%{python2_bin_suffix} ] ; then
update-alternatives --remove cairosvg %{_bindir}/cairosvg-%{python2_bin_suffix}
fi
%if %{with test}
%check
nosetests-%{python2_bin_suffix}
%endif
%files
%defattr(-,root,root,-)
%doc COPYING NEWS.rst README.rst TODO.rst
%{_bindir}/cairosvg
%{_bindir}/cairosvg-%{python2_bin_suffix}
%ghost %{_sysconfdir}/alternatives/cairosvg
%{python2_sitelib}/*
%changelog