de7c1de
%if 0%{?fedora} > 12
59a8e4c
%global with_python3 1
59a8e4c
%else
59a8e4c
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
59a8e4c
%endif
59a8e4c
59a8e4c
Name:           python-cairocffi
de7c1de
Version:        0.5.4
de7c1de
Release:        1%{?dist}
59a8e4c
Group:          Development/Libraries
59a8e4c
Summary:        cffi-based cairo bindings for Python
59a8e4c
License:        BSD
59a8e4c
URL:            https://pypi.python.org/pypi/cairocffi/
59a8e4c
Source0:        https://github.com/SimonSapin/cairocffi/archive/v%{version}.tar.gz
59a8e4c
BuildArch:      noarch
59a8e4c
59a8e4c
BuildRequires:  python2-devel python-setuptools
59a8e4c
%if 0%{?with_python3}
59a8e4c
BuildRequires:  python3-devel python3-setuptools
59a8e4c
%endif # if with_python3
59a8e4c
755d430
Requires:       python-cffi cairo
755d430
%if 0%{?fedora} > 13 || 0%{?rhel} > 6
755d430
Requires:       gdk-pixbuf2
755d430
%endif
59a8e4c
59a8e4c
%description
59a8e4c
cairocffi is a CFFI-based drop-in replacement for Pycairo, a set of
59a8e4c
Python bindings and object-oriented API for cairo.  Cairo is a 2D
59a8e4c
vector graphics library with support for multiple backends including
59a8e4c
image buffers, PNG, PostScript, PDF, and SVG file output.
59a8e4c
59a8e4c
%if 0%{?with_python3}
59a8e4c
%package -n python3-cairocffi
59a8e4c
Group:          Development/Libraries
59a8e4c
Summary:        cffi-based cairo bindings for Python
59a8e4c
59a8e4c
%description -n python3-cairocffi
59a8e4c
cairocffi is a CFFI-based drop-in replacement for Pycairo, a set of
59a8e4c
Python bindings and object-oriented API for cairo.  Cairo is a 2D
59a8e4c
vector graphics library with support for multiple backends including
59a8e4c
image buffers, PNG, PostScript, PDF, and SVG file output.
59a8e4c
%endif # if with_python3
59a8e4c
59a8e4c
%prep
59a8e4c
%setup -q -n cairocffi-%{version}
59a8e4c
59a8e4c
%if 0%{?with_python3}
59a8e4c
rm -rf %{py3dir}
59a8e4c
cp -a . %{py3dir}
59a8e4c
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!/usr/bin/python|#!%{__python3}|'
59a8e4c
%endif # with_python3
59a8e4c
59a8e4c
%build
59a8e4c
%{__python} setup.py build
59a8e4c
59a8e4c
%if 0%{?with_python3}
59a8e4c
pushd %{py3dir}
59a8e4c
# rpmbuild defaults to exporting LANG="C", which screws up Python 3's
59a8e4c
# default encoidng, and breaks setup.py reading cairocffi/__init__.py,
59a8e4c
# even though that file has an explicit tag of being UTF-8.
59a8e4c
LANG="en_US.UTF-8" %{__python3} setup.py build
59a8e4c
popd
59a8e4c
%endif # with_python3
59a8e4c
59a8e4c
%install
59a8e4c
%{__python} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
59a8e4c
59a8e4c
%if 0%{?with_python3}
59a8e4c
pushd %{py3dir}
59a8e4c
LANG="en_US.UTF-8" %{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
59a8e4c
popd
59a8e4c
%endif # with_python3
59a8e4c
59a8e4c
%files
59a8e4c
%doc LICENSE CHANGES README.rst docs
59a8e4c
%{python_sitelib}/*
59a8e4c
59a8e4c
%if 0%{?with_python3}
59a8e4c
%files -n python3-cairocffi
59a8e4c
%doc LICENSE CHANGES README.rst docs
59a8e4c
%{python3_sitelib}/*
59a8e4c
%endif # with_python3
59a8e4c
59a8e4c
%changelog
de7c1de
* Mon Aug 25 2014 Eric Smith <brouhaha@fedoraproject.org> 0.5.4-1
de7c1de
- Update to latest upstream.
de7c1de
- No python3 in EL7.
de7c1de
491a48d
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.1-5
491a48d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
491a48d
22fe458
* Tue May 27 2014 Kalev Lember <kalevlember@gmail.com> - 0.5.1-4
22fe458
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
22fe458
755d430
* Fri Jul 26 2013 Eric Smith <brouhaha@fedoraproject.org> 0.5.1-3
755d430
- For EL6, remove require of gdk-pixbuf2.
755d430
59a8e4c
* Tue Jul 23 2013 Eric Smith <brouhaha@fedoraproject.org> 0.5.1-2
59a8e4c
- Added Python 3 support.
59a8e4c
59a8e4c
* Sun Jul 21 2013 Eric Smith <brouhaha@fedoraproject.org> 0.5.1-1
59a8e4c
- initial version