%if 0%{?fedora}
%global with_python3 1
%endif
%global modname cairosvg
%global eggname CairoSVG
Name: python-cairosvg
Version: 0.5
Release: 1%{?dist}
Summary: A Simple SVG Converter for Cairo
Group: Development/Libraries
License: LGPLv3
URL: http://pypi.python.org/pypi/CairoSVG
Source0: http://pypi.python.org/packages/source/C/%{eggname}/%{eggname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: python2-devel
BuildRequires: pycairo
Requires: pycairo
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-cairo
%endif
%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
`_.
%if 0%{?with_python3}
%package -n python3-CairoSVG
Summary: A Simple SVG Converter for Cairo
Group: Development/Libraries
Requires: python3-cairo
%description -n python3-CairoSVG
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
`_.
%endif
%prep
%setup -q -n %{eggname}-%{version}
# Remove bundled egg-info in case it exists
rm -rf %{eggname}.egg-info
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif
%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}/%{_bindir}/cairosvg %{buildroot}/%{_bindir}/python3-cairosvg
popd
%endif
%{__python} setup.py install -O1 --skip-build --root=%{buildroot}
%files
%doc README.rst COPYING NEWS.rst TODO.rst
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{eggname}-%{version}*
%{_bindir}/cairosvg
%if 0%{?with_python3}
%files -n python3-CairoSVG
%doc README.rst COPYING NEWS.rst TODO.rst
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{eggname}-%{version}-*
%{_bindir}/python3-cairosvg
%endif
%changelog
* Sat Apr 13 2013 Ralph Bean - 0.5-1
- Initial package for Fedora