Remove pregenerated Cython C sources in %build

In a future version of mock, %prep will only run once,
which breaks the prior state of this package.

Previously, this only worked because each %prep round restored
the pregenerated files for the setup.py logic to see.

However, when %prep only runs once, the second round of
%pyproject_buildrequires fails unless Cython is already installed,
which is not the default case,
as the dependency has not yet been generated.

See https://github.com/rpm-software-management/mock/pull/1250
This commit is contained in:
Miro Hrončok 2023-10-30 12:36:41 +01:00
parent 55f5648cc5
commit 3b50336b27

View File

@ -1,6 +1,6 @@
Name: python-lxml
Version: 4.9.3
Release: 2%{?dist}
Release: 3%{?dist}
Summary: XML processing library combining libxml2/libxslt with the ElementTree API
# The lxml project is licensed under BSD-3-Clause
@ -75,12 +75,12 @@ Python 3 version.
%generate_buildrequires
%pyproject_buildrequires -x source%{?with_extras:,cssselect,html5,htmlsoup}
%build
# Remove pregenerated Cython C sources
# We need to do this after %%pyproject_buildrequires because setup.py errors
# without Cython and without the .c files.
find -type f -name '*.c' -print -delete >&2
%build
export WITH_CYTHON=true
%pyproject_wheel
@ -100,6 +100,9 @@ cp -a build/lib.%{python3_platform}-*/* src/
%doc README.rst
%changelog
* Mon Oct 30 2023 Miro Hrončok <mhroncok@redhat.com> - 4.9.3-3
- Fix build with a future mock version
* Fri Jul 28 2023 Miro Hrončok <mhroncok@redhat.com> - 4.9.3-2
- Fix build with Cython 3