Utilize the bootstrap.egg-info from the github tarball

Since Python 3.11.1, the setuptools builds are broken if the pre-
generated egg-info directory is removed.

We work around the issue by extracting the bootstrap.egg-info directory
from the github tarball.

Note that the bootstrap build doesn't work, however on F37 we won't bootstrap
anyway, so this is considered a workaround.

See also: https://github.com/pypa/setuptools/issues/3761
This commit is contained in:
Charalampos Stratakis 2023-04-14 04:37:44 +02:00
parent a3c06a495c
commit b3c9e12e27
2 changed files with 10 additions and 5 deletions

View File

@ -43,7 +43,10 @@ Summary: Easily build and distribute Python packages
# the setuptools logo is MIT
License: MIT and ASL 2.0 and (BSD or ASL 2.0) and Python
URL: https://pypi.python.org/pypi/%{srcname}
# We require the sdist from PyPI to build the package and the
# github tarball only for the bootstrap.egg-info directory.
Source0: %{pypi_source %{srcname} %{version}}
Source1: https://github.com/pypa/%{srcname}/archive/v%{version}/%{srcname}-%{version}-github.tar.gz
# Some test deps are optional and either not desired or not available in Fedora, thus this patch removes them.
Patch: Remove-optional-or-unpackaged-test-deps.patch
@ -129,12 +132,13 @@ A Python wheel of setuptools to use with venv.
%prep
%autosetup -p1 -n %{srcname}-%{version}
%if %{without bootstrap}
# If we don't have setuptools installed yet, we use the pre-generated .egg-info
# See https://github.com/pypa/setuptools/pull/2543
# And https://github.com/pypa/setuptools/issues/2550
# Removing the egg-info directory breaks the build since Python 3.11.1,
# but we workaround the issue by utilizing the bootstrap.egg-info
# directory from the github tarball.
# see https://github.com/pypa/setuptools/issues/3761
rm -r %{srcname}.egg-info
%endif
# Extract the bootstrap.egg-info from the github tarball
tar -xzf %{SOURCE1} --strip=1 setuptools-%{version}/bootstrap.egg-info
# Strip shbang
find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'

View File

@ -1 +1,2 @@
SHA512 (setuptools-62.6.0-github.tar.gz) = 7fcd4e2d8ee7c070f46633a5804ecb328420e4e40ad6835591a11e0ad8842bddb5e4bb8b83b136d32116645070123ac3daeb318d290314e77a409b2fb39554e5
SHA512 (setuptools-62.6.0.tar.gz) = d67c438d507fc7959162b5e8c2a15e9c36d37e5cd7052e16eeb58d8a9bcf19b725a0e7b840e101500799d725bbc4c1872d0f79eead66a538e891cc7cfbe3d979