%if 0%{?fedora} %bcond_without python3 %else %bcond_with python3 %endif Name: python-libmodsecurity Version: 0.git20160215 Release: 1%{?dist} Summary: Python bindings for libmodsecurity License: ASL 2.0 URL: https://github.com/SpiderLabs/ModSecurity-Python-bindings # Pre-release Source0: %{name}-%{version}.tar.gz BuildRequires: python2-devel swig BuildRequires: libmodsecurity-devel %if %{with python3} BuildRequires: python3-devel %endif # with python3 %description Python bindings for libmodsecurity %if %{with python3} %package -n python3-libmodsecurity Summary: Python 3 bindings for libmodsecurity %description -n python3-libmodsecurity Python 3 bindings for libmodsecurity %endif # with python3 %prep %setup -qc mv %{name}-%{version} python2 %if %{with python3} cp -a python2 python3 %endif # with python3 %build pushd python2 swig -I/usr/include/ -python -builtin -Wall -Wextra -c++ modsecurity/modsecurity.i CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build_ext --inplace popd %if %{with python3} pushd python3 swig -I/usr/include/ -python -py3 -builtin -Wall -Wextra -c++ modsecurity/modsecurity.i CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build_ext --inplace popd %endif # with python3 %install %if %{with python3} pushd python3 %{__python3} setup.py install --prefix=%{buildroot}%{_prefix} popd %endif # with python3 pushd python2 %{__python2} setup.py install --prefix=%{buildroot}%{_prefix} popd %check pushd python2 popd %if %{with python3} pushd python3 popd %endif %files %doc python2/README.md python2/CHANGES %{python2_sitearch}/* %if %{with python3} %files -n python3-libmodsecurity %doc python3/README.md python3/CHANGES %{python3_sitearch}/* %endif # with python3 %changelog * Tue Feb 23 2016 Athmane Madjoudj 0.git20160215-1 - Initial release