Use pyproject macros (rhbz#2377745)

This commit is contained in:
Orion Poplawski 2025-08-10 17:00:30 -06:00
commit aeaf20d9d2

View file

@ -32,14 +32,7 @@ Features include:
%package -n python3-%{modname}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-Cython
BuildRequires: python3-greenlet-devel >= 2.0.0
BuildRequires: python3-setuptools
# For tests
BuildRequires: python3-dns
BuildRequires: python3-psutil
BuildRequires: python3-zope-event
BuildRequires: python3-zope-interface
%description -n python3-%{modname}
gevent is a coroutine-based Python networking library that uses greenlet to
@ -64,6 +57,8 @@ rm -r deps
# 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
# No linters
sed -i -e '/coverage/d' -e '/objgraph/d' setup.py
# Force re-cythonizing the sources - missing with github tarballs
rm -f $(grep -rl '/\* Generated by Cython')
@ -72,28 +67,30 @@ rm -f src/gevent/_generated_include/*
# Test requires network, fails in mock/koji
mv src/gevent/tests/test__resolver_dnspython.py{,.needsnetwork}
%generate_buildrequires
%pyproject_buildrequires -t
%build
export GEVENTSETUP_EMBED=0
# Build Python 3 first to use Python 3 Cython
%py3_build
%pyproject_wheel
%install
export GEVENTSETUP_EMBED=0
%py3_install
%pyproject_install
find %{buildroot} -name '.buildinfo' -delete
# Correct the permissions.
find %{buildroot} -name '*.so' -exec chmod 755 {} ';'
%pyproject_save_files -l %{modname}
%check
export PYTHONPATH=%{buildroot}%{python3_sitearch}
# test_resolution is failing - https://github.com/gevent/gevent/issues/2064
%__python3 -m gevent.tests || :
%__python3 -m gevent.tests --verbose || :
cd src/gevent/tests && GEVENT_FILE=thread %__python3 -mgevent.tests test__*subprocess*.py
%files -n python3-%{modname}
%license LICENSE
%files -n python3-%{modname} -f %{pyproject_files}
%doc README.rst
%{python3_sitearch}/%{modname}*
%changelog
%autochangelog