From d195d55abffdf51512b46ff862834e4ec39bf70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Wed, 15 Mar 2023 23:24:57 +0100 Subject: [PATCH] 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 from distutils.util import byte_compile ModuleNotFoundError: No module named 'distutils' error: command '/usr/bin/python3' failed with exit code 1 --- python-setuptools.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python-setuptools.spec b/python-setuptools.spec index 4866984..65b234d 100644 --- a/python-setuptools.spec +++ b/python-setuptools.spec @@ -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