# 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 Fedora and el8+ %if 0%{?fedora} || 0%{?rhel} > 7 %bcond_with python2 %else %bcond_without python2 %endif # test dependencies are not available on el9+ %if 0%{?fedora} # %%bcond_without tests %bcond_with tests %else %bcond_with tests %endif %global modname pycurl %global __python3 /usr/bin/python3.11 %global python3_pkgversion 3.11 Name: python-%{modname} Version: 7.45.1 Release: 4%{?dist} Summary: A Python interface to libcurl License: LGPLv2+ or MIT URL: http://pycurl.io/ Source0: https://files.pythonhosted.org/packages/47/f9/c41d6830f7bd4e70d5726d26f8564538d08ca3a7ac3db98b325f94cdcb7f/pycurl-%{version}.tar.gz # drop link-time vs. run-time TLS backend check (#1446850) Patch1: 0001-python-pycurl-7.45.1-tls-backend.patch # https://github.com/pycurl/pycurl/pull/753 Patch2: 0002-python-pycurl-7.45.1-curl-7.83-compatibility.patch BuildRequires: gcc BuildRequires: libcurl-devel BuildRequires: make BuildRequires: openssl-devel BuildRequires: vsftpd # During its initialization, PycURL checks that the actual libcurl version # is not lower than the one used when PycURL was built. # Yes, that should be handled by library versioning (which would then get # automatically reflected by rpm). # For now, we have to reflect that dependency. %global libcurl_sed '/^#define LIBCURL_VERSION "/!d;s/"[^"]*$//;s/.*"//;q' %global curlver_h /usr/include/curl/curlver.h %global libcurl_ver %(sed %{libcurl_sed} %{curlver_h} 2>/dev/null || echo 0) %description PycURL is a Python interface to libcurl. PycURL can be used to fetch 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}} BuildRequires: python2-devel Requires: libcurl%{?_isa} >= %{libcurl_ver} Provides: %{modname} = %{version}-%{release} %description -n python2-%{modname} PycURL is a Python interface to libcurl. PycURL can be used to fetch 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. Python 2 version. %endif %if %{with python3} %package -n python%{python3_pkgversion}-%{modname} Summary: Python interface to libcurl for Python 3 %{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}} BuildRequires: python%{python3_pkgversion}-devel %if %{with tests} BuildRequires: python%{python3_pkgversion}-bottle BuildRequires: python%{python3_pkgversion}-flaky BuildRequires: python%{python3_pkgversion}-pytest %global pytest pytest %else %global pytest true %endif BuildRequires: python%{python3_pkgversion}-setuptools Requires: libcurl%{?_isa} >= %{libcurl_ver} %description -n python%{python3_pkgversion}-%{modname} PycURL is a Python interface to libcurl. PycURL can be used to fetch 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. Python 3 version. %endif %prep %autosetup -n %{modname}-%{version} -p1 # remove windows-specific build script rm -fv winbuild.py # use %%{python3} instead of python to invoke tests, to make them work on f34 sed -e 's|python |%{python3} |' -i tests/ext/test-suite.sh # use %%py3_shebang_fix after EPEL 7 EOL sed -e 's|^#! */usr/bin/env python$|#! /usr/bin/env %{python3}|' \ -i tests/*.py setup.py %build %if %{with python2} %py2_build -- --with-openssl %endif %if %{with python3} %py3_build -- --with-openssl %endif %install export PYCURL_SSL_LIBRARY=openssl %if %{with python2} %py2_install %endif %if %{with python3} %py3_install %endif rm -rf %{buildroot}%{_datadir}/doc/pycurl %if %{with python3} %check # relax crypto policy for the test-suite to make it pass again (#1863711) export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=XXX export OPENSSL_CONF= export PYTHONPATH=%{buildroot}%{python3_sitearch} export PYCURL_SSL_LIBRARY=openssl export PYCURL_VSFTPD_PATH=vsftpd export PYTEST_ADDOPTS="--ignore examples -m 'not online'" make test PYTHON=%{__python3} PYTEST=%{pytest} PYFLAKES=true rm -fv tests/fake-curl/libcurl/*.so rm -fvr tests/__pycache__ %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 python%{python3_pkgversion}-%{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