ab93ff
%if 0%{?fedora} > 12
ab93ff
%global with_python3 1
ab93ff
%else
ab93ff
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")}
ab93ff
%endif
ab93ff
ab93ff
Name:           python-cffi
ab93ff
Version:        0.8.6
ab93ff
Release:        2%{?dist}
ab93ff
Group:          Development/Libraries
ab93ff
Summary:        Foreign Function Interface for Python to call C code
ab93ff
License:        MIT
ab93ff
URL:            http://cffi.readthedocs.org/
ab93ff
Source0:        http://pypi.python.org/packages/source/c/cffi/cffi-%{version}.tar.gz
ab93ff
ab93ff
BuildRequires:  libffi-devel python-sphinx
ab93ff
BuildRequires:  python2-devel python-setuptools Cython python-pycparser
ab93ff
%if 0%{?with_python3}
ab93ff
BuildRequires:  python3-devel python3-setuptools python3-Cython python3-pycparser
ab93ff
%endif # if with_python3
ab93ff
ab93ff
Requires:       python-pycparser
ab93ff
ab93ff
# Do not check .so files in the python_sitelib directory
ab93ff
# or any files in the application's directory for provides
ab93ff
%global __provides_exclude_from ^(%{python_sitearch}|%{python3_sitearch})/.*\\.so$
ab93ff
ab93ff
%description
ab93ff
Foreign Function Interface for Python, providing a convenient and
ab93ff
reliable way of calling existing C code from Python. The interface is
ab93ff
based on LuaJIT’s FFI.
ab93ff
ab93ff
%if 0%{?with_python3}
ab93ff
%package -n python3-cffi
ab93ff
Summary:        Foreign Function Interface for Python 3 to call C code
ab93ff
Group:          Development/Libraries
ab93ff
Requires:       python3-pycparser
ab93ff
ab93ff
%description -n python3-cffi
ab93ff
Foreign Function Interface for Python, providing a convenient and
ab93ff
reliable way of calling existing C code from Python. The interface is
ab93ff
based on LuaJIT’s FFI.
ab93ff
%endif # with_python3
ab93ff
ab93ff
%package doc
ab93ff
Summary:        Documentation for CFFI
ab93ff
Group:          Documentation
ab93ff
BuildArch:      noarch
ab93ff
Requires:       %{name} = %{version}-%{release}
ab93ff
ab93ff
%description doc
ab93ff
Documentation for CFFI, the Foreign Function Interface for Python.
ab93ff
ab93ff
%prep
ab93ff
%setup -q -n cffi-%{version}
ab93ff
ab93ff
%if 0%{?with_python3}
ab93ff
rm -rf %{py3dir}
ab93ff
cp -a . %{py3dir}
ab93ff
%endif # with_python3
ab93ff
ab93ff
%build
ab93ff
%if 0%{?with_python3}
ab93ff
pushd %{py3dir}
ab93ff
%{__python3} setup.py build
ab93ff
popd
ab93ff
%endif # with_python3
ab93ff
ab93ff
%{__python} setup.py build
ab93ff
cd doc
ab93ff
make html
ab93ff
rm build/html/.buildinfo
ab93ff
ab93ff
#%check
ab93ff
## The following test procedure works when I run it manually, but fails
ab93ff
## from rpmbuild, complaining that it can't import _cffi_backend, and I'm
ab93ff
## not sure how to make it work
ab93ff
#python setup_base.py build
ab93ff
#PYTHONPATH=build/lib.linux-* py.test c/ testing/
ab93ff
ab93ff
%install
ab93ff
%if 0%{?with_python3}
ab93ff
pushd %{py3dir}
ab93ff
%{__python3} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
ab93ff
popd
ab93ff
%endif # with_python3
ab93ff
%{__python} setup.py install --skip-build --prefix=%{_prefix} --root %{buildroot}
ab93ff
ab93ff
%files
ab93ff
%doc LICENSE PKG-INFO
ab93ff
%{python_sitearch}/*
ab93ff
ab93ff
%if 0%{?with_python3}
ab93ff
%files -n python3-cffi
ab93ff
%doc LICENSE PKG-INFO
ab93ff
%{python3_sitearch}/*
ab93ff
%endif # with_python3
ab93ff
ab93ff
%files doc
ab93ff
%doc doc/build/html
ab93ff
ab93ff
%changelog
ab93ff
* Tue Jun 16 2015 Nathaniel McCallum <npmccallum@redhat.com> - 0.8.6-2
ab93ff
- Fix license
ab93ff
ab93ff
* Tue Aug 19 2014 Eric Smith <spacewar@gmail.com> 0.8.6-1
ab93ff
- Update to latest upstream.
ab93ff
- No python3 in el7.
ab93ff
ab93ff
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.1-4
ab93ff
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
ab93ff
ab93ff
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.8.1-3
ab93ff
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
ab93ff
ab93ff
* Mon May 12 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.8.1-2
ab93ff
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4
ab93ff
ab93ff
* Wed Feb 26 2014 Eric Smith <spacewar@gmail.com> 0.8.1-1
ab93ff
- Update to latest upstream.
ab93ff
ab93ff
* Tue Aug 13 2013 Eric Smith <spacewar@gmail.com> 0.6-5
ab93ff
- Add Requires of python{,3}-pycparser.
ab93ff
ab93ff
* Thu Jul 25 2013 Eric Smith <spacewar@gmail.com> 0.6-4
ab93ff
- Fix broken conditionals in spec (missing question marks), needed for el6.
ab93ff
ab93ff
* Tue Jul 23 2013 Eric Smith <spacewar@gmail.com> 0.6-3
ab93ff
- Add Python3 support.
ab93ff
ab93ff
* Mon Jul 22 2013 Eric Smith <spacewar@gmail.com> 0.6-2
ab93ff
- Better URL, and use version macro in Source0.
ab93ff
ab93ff
* Sun Jul 21 2013 Eric Smith <spacewar@gmail.com> 0.6-1
ab93ff
- initial version