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
95279e
Version:        1.6.0
95279e
Release:        5%{?dist}
ab93ff
Summary:        Foreign Function Interface for Python to call C code
ab93ff
License:        MIT
ab93ff
URL:            http://cffi.readthedocs.org/
95279e
Source0:        https://pypi.io/packages/source/c/cffi/cffi-%{version}.tar.gz
ab93ff
ab93ff
BuildRequires:  libffi-devel python-sphinx
95279e
BuildRequires:  python-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
Requires:       python3-pycparser
95279e
%{?python_provide:%python_provide python3-cffi}
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
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
95279e
%{__python} setup.py install \
95279e
    --skip-build --prefix=%{_prefix} --root %{buildroot} \
95279e
    --record %{buildroot}%{python_sitearch}/cffi-%{version}-py2.7.egg-info/installed-files.txt
ab93ff
ab93ff
%files
95279e
%doc PKG-INFO
95279e
%license LICENSE
ab93ff
%{python_sitearch}/*
ab93ff
ab93ff
%if 0%{?with_python3}
ab93ff
%files -n python3-cffi
95279e
%doc PKG-INFO
95279e
%license LICENSE
ab93ff
%{python3_sitearch}/*
ab93ff
%endif # with_python3
ab93ff
ab93ff
%files doc
ab93ff
%doc doc/build/html
ab93ff
ab93ff
%changelog
95279e
* Tue Aug 09 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.6.0-5
95279e
- Record installed files (#1255206)
95279e
95279e
* Tue May 03 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.6.0-4
95279e
- Import from Fedora
95279e
- Migrate python2-cffi => python-cffi
95279e
95279e
* Thu Apr 28 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6.0-3
95279e
- Switch Source0 to using pypi.io
95279e
95279e
* Thu Apr 28 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6.0-2
95279e
- Update Source0 URL to account for pypi change
95279e
95279e
* Thu Apr 21 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.6.0-1
95279e
- Update to 1.6.0 (#1329203)
95279e
95279e
* Mon Feb 15 2016 John Dulaney <jdulaney@fedoraproject.org> - 1.5.2-1
95279e
- Update to 1.5.2 (#1299272)
95279e
95279e
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
95279e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
95279e
95279e
* Mon Jan 18 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.5.0-1
95279e
- Update to 1.5.0 (#1299272)
95279e
95279e
* Mon Jan 11 2016 Nathaniel McCallum <npmccallum@redhat.com> - 1.4.2-2
95279e
- Move python-cffi => python2-cffi
95279e
95279e
* Tue Dec 22 2015 John Dulaney <jdulaney@fedoraproject.org> - 1.4.2-1
95279e
- Update to 1.4.2 (#1293504)
95279e
95279e
* Thu Dec 17 2015 John Dulaney <jdulaney@fedoraproject.org> - 1.4.1-1
95279e
- Update to latest upstream release
95279e
95279e
* Fri Dec 11 2015 John Dulaney <jdulaney@fedoraproject.org> - 1.3.1-1
95279e
- Update to latest upstream release
95279e
95279e
* Tue Oct 13 2015 Robert Kuska <rkuska@redhat.com> - 1.1.2-4
95279e
- Rebuilt for Python3.5 rebuild
95279e
95279e
* Wed Jul 15 2015 Parag Nemade <pnemade AT redhat DOT com> - 1.1.2-3
95279e
- Modernize spec file
95279e
- add missing source
95279e
95279e
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2-2
95279e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
95279e
95279e
* Tue Jun 16 2015 Nathaniel McCallum <npmccallum@redhat.com> - 1.1.2-2
95279e
- Update to 1.1.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