File python-cffi.spec of Package python-cffi-rhel
%define realname cffi
%define srcext tar.bz2
%if ! 0%{?py_ver:1}
%define py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
%endif
# Common info
Name: python-%{realname}
Version: 1.9.1
Release: wiz%{?extraver:0.}1%{?dist}
License: MIT
Group: Development/Languages/Python
URL: http://cffi.readthedocs.io/
Summary: Foreign Function Interface for Python calling C code
# Install-time parameters
Requires: python%{?suse_version:-base}
Requires: python-pycparser
# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: pkgconfig(libffi)
BuildRoot: %{_tmppath}/%{name}-root
Source: %{realname}-%{version}%{?extraver}.%{srcext}
%description
C Foreign Function Interface for Python. Interact with almost any C code from
Python, based on C-like declarations that you can often copy-paste from header
files or documentation.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%build
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} -O2
[ "%{buildroot}" != "/" ] && find %{buildroot}%{python_sitearch}/%{realname}/ -name "*.pyo" -delete
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc AUTHORS LICENSE README.md
%{python_sitearch}/%{realname}/
%{python_sitearch}/_cffi_backend.so
%{python_sitearch}/%{realname}-%{version}-py%{py_ver}.egg-info/
%changelog