Make the bootstrap build work on Python without distutils

The setup.py install command tries to import distutils
but the distutils-precedence.pth file is not yet respected
and Python 3.12+ no longer has distutils in the standard library.

The error was:

    Executing(%install): ...
    ...
    + /usr/bin/python3 setup.py install -O1 --skip-build --root /builddir/build/BUILDROOT/python-setuptools-65.5.1-3.fc39~bootstrap.x86_64 --prefix /usr
    running install
    ...
    writing byte-compilation script '/tmp/tmpuud06dfj.py'
    /usr/bin/python3 /tmp/tmpuud06dfj.py
    Traceback (most recent call last):
      File "/tmp/tmpuud06dfj.py", line 1, in <module>
        from distutils.util import byte_compile
    ModuleNotFoundError: No module named 'distutils'
    error: command '/usr/bin/python3' failed with exit code 1
This commit is contained in:
Miro Hrončok 2023-03-15 23:24:57 +01:00
parent d5c59824d3
commit d195d55abf

View File

@ -150,7 +150,12 @@ rm -r docs/conf.py
%install
%if %{with bootstrap}
%py3_install
# The setup.py install command tries to import distutils
# but the distutils-precedence.pth file is not yet respected
# and Python 3.12+ no longer has distutils in the standard library.
ln -s setuptools/_distutils distutils
PYTHONPATH=$PWD %py3_install
unlink distutils
%else
%pyproject_install
%pyproject_save_files setuptools pkg_resources _distutils_hack