Skip to content

Commit

Permalink
Utilize the bootstrap.egg-info from the github tarball
Browse files Browse the repository at this point in the history
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: pypa/setuptools#3761
  • Loading branch information
stratakis committed Apr 19, 2023
1 parent a3c06a4 commit b3c9e12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions python-setuptools.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}'
Expand Down
1 change: 1 addition & 0 deletions sources
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SHA512 (setuptools-62.6.0-github.tar.gz) = 7fcd4e2d8ee7c070f46633a5804ecb328420e4e40ad6835591a11e0ad8842bddb5e4bb8b83b136d32116645070123ac3daeb318d290314e77a409b2fb39554e5
SHA512 (setuptools-62.6.0.tar.gz) = d67c438d507fc7959162b5e8c2a15e9c36d37e5cd7052e16eeb58d8a9bcf19b725a0e7b840e101500799d725bbc4c1872d0f79eead66a538e891cc7cfbe3d979

0 comments on commit b3c9e12

Please sign in to comment.