diff --git a/python-pycurl.spec b/python-pycurl.spec index 716636c..ec50d53 100644 --- a/python-pycurl.spec +++ b/python-pycurl.spec @@ -1,8 +1,22 @@ +# python3 is not available on RHEL <= 7 +%if 0%{?fedora} || 0%{?rhel} > 7 +%bcond_without python3 +%else +%bcond_with python3 +%endif + +# python2 is not available on RHEL > 7 and not needed on Fedora > 29 +%if 0%{?rhel} > 7 || 0%{?fedora} > 29 +%bcond_with python2 +%else +%bcond_without python2 +%endif + %global modname pycurl Name: python-%{modname} Version: 7.43.0 -Release: 16%{?dist} +Release: 17%{?dist} Summary: A Python interface to libcurl License: LGPLv2+ or MIT @@ -35,6 +49,7 @@ objects identified by a URL from a Python program, similar to the urllib Python module. PycURL is mature, very fast, and supports a lot of features. +%if %{with python2} %package -n python2-%{modname} Summary: Python interface to libcurl for Python 2 %{?python_provide:%python_provide python2-%{modname}} @@ -53,7 +68,9 @@ urllib Python module. PycURL is mature, very fast, and supports a lot of features. Python 2 version. +%endif +%if %{with python3} %package -n python3-%{modname} Summary: Python interface to libcurl for Python 3 %{?python_provide:%python_provide python3-%{modname}} @@ -70,6 +87,7 @@ urllib Python module. PycURL is mature, very fast, and supports a lot of features. Python 3 version. +%endif %prep %autosetup -n %{modname}-%{version} -p1 @@ -92,35 +110,52 @@ sed -e 's/ --show-skipped//' \ -i tests/run.sh %build +%if %{with python2} %py2_build -- --with-openssl +%endif +%if %{with python3} %py3_build -- --with-openssl +%endif %install +%if %{with python2} %py2_install +%endif +%if %{with python3} %py3_install +%endif rm -rf %{buildroot}%{_datadir}/doc/pycurl +%if %{with python3} %check export PYTHONPATH=%{buildroot}%{python3_sitearch} export PYCURL_VSFTPD_PATH=vsftpd make test PYTHON=%{__python3} NOSETESTS="nosetests-%{python3_version} -v" rm -fv tests/fake-curl/libcurl/*.so +%endif +%if %{with python2} %files -n python2-%{modname} %license COPYING-LGPL COPYING-MIT %doc ChangeLog README.rst examples doc tests %{python2_sitearch}/curl/ %{python2_sitearch}/%{modname}.so %{python2_sitearch}/%{modname}-%{version}-*.egg-info +%endif +%if %{with python3} %files -n python3-%{modname} %license COPYING-LGPL COPYING-MIT %doc ChangeLog README.rst examples doc tests %{python3_sitearch}/curl/ %{python3_sitearch}/%{modname}.*.so %{python3_sitearch}/%{modname}-%{version}-*.egg-info +%endif %changelog +* Wed May 30 2018 Kamil Dudka - 7.43.0-17 +- make the python2 and python3 subpackages optional + * Wed May 23 2018 Kamil Dudka - 7.43.0-16 - fix build failure caused by NotImplemented exceptions in winbuild.py