%global __provides_exclude_from ^%{python3_sitearch}/.*\\.so$ %global modname gevent %global optflags %(echo %{optflags} -I%{_includedir}/libev) %global __python3 /usr/bin/python3.11 %global python3_pkgversion 3.11 Name: python-%{modname} Version: 21.12.0 Release: 4%{?dist} Summary: A coroutine-based Python networking library License: MIT URL: http://www.gevent.org/ Source0: %{pypi_source %{modname} %{version} tar.gz} # Support Python 3.11 # Discussion in https://github.com/gevent/gevent/pull/1872.patch Patch: https://github.com/gevent/gevent/compare/master...hroncok:py311b3.patch BuildRequires: gcc BuildRequires: c-ares-devel BuildRequires: libev-devel >= 4.33 BuildRequires: libuv-devel %description gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of libevent event loop. Features include: * convenient API around greenlets * familiar synchronization primitives (gevent.event, gevent.queue) * socket module that cooperates * WSGI server on top of libevent-http * DNS requests done through libevent-dns * monkey patching utility to get pure Python modules to cooperate %package -n python%{python3_pkgversion}-%{modname} Summary: %{summary} %{?python_provide:%python_provide python%{python3_pkgversion}-%{modname}} BuildRequires: python%{python3_pkgversion}-devel BuildRequires: python%{python3_pkgversion}-Cython BuildRequires: python%{python3_pkgversion}-greenlet-devel >= 1.1.0 BuildRequires: python%{python3_pkgversion}-setuptools # For tests # BuildRequires: python%%{python3_pkgversion}-dns # BuildRequires: python%%{python3_pkgversion}-psutil # BuildRequires: python%%{python3_pkgversion}-zope-event # BuildRequires: python%%{python3_pkgversion}-zope-interface %description -n python%{python3_pkgversion}-%{modname} gevent is a coroutine-based Python networking library that uses greenlet to provide a high-level synchronous API on top of libevent event loop. Features include: * convenient API around greenlets * familiar synchronization primitives (gevent.event, gevent.queue) * socket module that cooperates * WSGI server on top of libevent-http * DNS requests done through libevent-dns * monkey patching utility to get pure Python modules to cooperate Python 3 version. %prep %autosetup -p1 -n %{modname}-%{version} # Remove bundled libraries rm -r deps # Upstream intentionally includes C extension sources in the built package, # because... reasons (PyPy I think?) however we do not want that. Sources will # go into debuginfo as normal. sed -i -e 's/include_package_data=True/include_package_data=False/' setup.py # Force re-cythonizing the sources rm $(grep -rl '/\* Generated by Cython') rm src/gevent/_generated_include/* %build export GEVENTSETUP_EMBED=0 # Build Python 3 first to use Python 3 Cython %py3_build %install export GEVENTSETUP_EMBED=0 %py3_install rm %{buildroot}%{python3_sitearch}/%{modname}/_*2.py rm %{buildroot}%{python3_sitearch}/%{modname}/__pycache__/_*2.* find %{buildroot} -name '.buildinfo' -delete # Correct the permissions. find %{buildroot} -name '*.so' -exec chmod 755 {} ';' # %%check # export PYTHONPATH=%%{buildroot}%%{python3_sitearch} # %%__python3 -m gevent.tests || : # cd src/gevent/tests && GEVENT_FILE=thread %%__python3 -mgevent.tests test__*subprocess*.py %files -n python%{python3_pkgversion}-%{modname} %license LICENSE %doc README.rst %{python3_sitearch}/%{modname}* %changelog