- modernize/simplify a bit
- sphinx by python3
- run tests again, but using the stuff we put into buildroot
- disable float tests on ppc64le (#1552724)
- BR gcc for build and gcc-c++ for tests
- be more explicit in %files
- enable Python dependency generator
This commit is contained in:
Miro Hrončok 2018-08-22 21:08:15 +02:00
parent 43342dbda7
commit dabc32b2d6

View File

@ -1,33 +1,18 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%endif
Name: python-cffi
Version: 1.11.5
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Foreign Function Interface for Python to call C code
License: MIT
URL: http://cffi.readthedocs.org/
Source0: https://pypi.io/packages/source/c/cffi/cffi-%{version}.tar.gz
Source0: %pypi_source cffi
BuildRequires: libffi-devel python2-sphinx
#BuildRequires: python2-pytest python3-pytest
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-Cython
BuildRequires: python2-pycparser
BuildRequires: python2-pytest
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: python3-pycparser
BuildRequires: python3-pytest
%endif # if with_python3
BuildRequires: libffi-devel
BuildRequires: gcc
# Do not check .so files in the python_sitelib directory
# or any files in the application's directory for provides
%global __provides_exclude_from ^(%{python_sitearch}|%{python3_sitearch})/.*\\.so$
# For tests:
BuildRequires: gcc-c++
%?python_enable_dependency_generator
%description
Foreign Function Interface for Python, providing a convenient and
@ -36,8 +21,12 @@ based on LuaJITs FFI.
%package -n python2-cffi
Summary: Foreign Function Interface for Python 3 to call C code
Requires: python2-pycparser
Obsoletes: python-cffi <= 1.4.2-1
BuildRequires: python2-pytest
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-Cython
BuildRequires: python2-pycparser
BuildRequires: python2-pytest
%{?python_provide:%python_provide python2-cffi}
%description -n python2-cffi
@ -45,71 +34,76 @@ Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJITs FFI.
%if 0%{?with_python3}
%package -n python3-cffi
Summary: Foreign Function Interface for Python 3 to call C code
Requires: python3-pycparser
BuildRequires: python3-sphinx
BuildRequires: python3-pytest
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-Cython
BuildRequires: python3-pycparser
BuildRequires: python3-pytest
%{?python_provide:%python_provide python3-cffi}
%description -n python3-cffi
Foreign Function Interface for Python, providing a convenient and
reliable way of calling existing C code from Python. The interface is
based on LuaJITs FFI.
%endif # with_python3
%package doc
Summary: Documentation for CFFI
BuildArch: noarch
Requires: python2-cffi = %{version}-%{release}
%description doc
Documentation for CFFI, the Foreign Function Interface for Python.
%prep
%setup -q -n cffi-%{version}
%autosetup -n cffi-%{version}
%build
%if 0%{?with_python3}
%py3_build
%endif # with_python3
%py2_build
%py3_build
cd doc
make html
make SPHINXBUILD=sphinx-build-3 html
rm build/html/.buildinfo
#Tests fail but only in mock.
#%check
#%{__python3} setup_base.py build_ext -f -i
#PYTHONPATH=build/lib.linux-* py.test-3 c/ testing/
#%{__python2} setup_base.py build_ext -f -i
#PYTHONPATH=build/lib.linux-* py.test c/ testing/
%install
%if 0%{?with_python3}
%py3_install \
--record %{buildroot}%{python3_sitearch}/cffi-%{version}-py%{python3_version}.egg-info/installed-files.txt
%endif # with_python3
%py2_install \
--record %{buildroot}%{python2_sitearch}/cffi-%{version}-py%{python2_version}.egg-info/installed-files.txt
%py2_install
%py3_install
%check
# https://bugzilla.redhat.com/show_bug.cgi?id=1552724
%ifarch ppc64le
k="not test_float and not test_complex_types"
%else
k=""
%endif
PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -m pytest -k "$k" c/ testing/
PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -m pytest -k "$k" c/ testing/
%files -n python2-cffi
%doc PKG-INFO
%license LICENSE
%{python2_sitearch}/*
%{python2_sitearch}/cffi/
%{python2_sitearch}/_cffi_backend.so
%{python2_sitearch}/cffi-%{version}-py%{python2_version}.egg-info/
%if 0%{?with_python3}
%files -n python3-cffi
%doc PKG-INFO
%license LICENSE
%{python3_sitearch}/*
%endif # with_python3
%{python3_sitearch}/cffi/
%{python3_sitearch}/_cffi_backend.*.so
%{python3_sitearch}/cffi-%{version}-py%{python3_version}.egg-info/
%files doc
%doc doc/build/html
%changelog
* Wed Aug 22 2018 Miro Hrončok <mhroncok@redhat.com> - 1.11.5-6
- Fix FTBFS (#1605627)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.11.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild