package/pkg-python: use SETUPTOOLS_USE_DISTUTILS=stdlib

# ipython -c 'import math; math.floor(12.3)'
-sh: ipython: not found

ipython use a wrong shebang on the target:

 # head -n 1 /usr/bin/ipython
 #!/home/kubu/buildroot/testsuite-master/TestIPythonPy3/host/bin/python

The issue come from python3-setuptools 60.0.0 that changed
SETUPTOOLS_USE_DISTUTILS default value from stdlib to local [1] to use
its local copy of distutils. This is actually a "breaking" change [2].

We have to override SETUPTOOLS_USE_DISTUTILS to the previous value
"stdlib" to fixes the issue.

While at it, use distutils from stdlib for the host.

Fixes:
https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091

[1] b6fcbbd00c
[2] https://github.com/pypa/setuptools/blob/v60.0.0/CHANGES.rst#breaking-changes

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: James Hilliard <james.hilliard1@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Romain Naour 2022-02-24 16:41:18 +01:00 committed by Peter Korsgaard
parent c4eebf191c
commit 4386bbdf08

View File

@ -40,6 +40,7 @@ PKG_PYTHON_DISTUTILS_ENV = \
LDSHARED="$(TARGET_CROSS)gcc -shared" \
PYTHONPATH="$(PYTHON3_PATH)" \
PYTHONNOUSERSITE=1 \
SETUPTOOLS_USE_DISTUTILS=stdlib \
_PYTHON_HOST_PLATFORM="$(PKG_PYTHON_HOST_PLATFORM)" \
_PYTHON_PROJECT_BASE="$(PYTHON3_DIR)" \
_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
@ -62,6 +63,7 @@ PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS = \
HOST_PKG_PYTHON_DISTUTILS_ENV = \
PATH=$(BR_PATH) \
PYTHONNOUSERSITE=1 \
SETUPTOOLS_USE_DISTUTILS=stdlib \
$(HOST_CONFIGURE_OPTS)
HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
@ -76,6 +78,7 @@ PKG_PYTHON_SETUPTOOLS_ENV = \
$(TARGET_CONFIGURE_OPTS) \
PYTHONPATH="$(PYTHON3_PATH)" \
PYTHONNOUSERSITE=1 \
SETUPTOOLS_USE_DISTUTILS=stdlib \
_python_sysroot=$(STAGING_DIR) \
_python_prefix=/usr \
_python_exec_prefix=/usr
@ -96,6 +99,7 @@ PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \
HOST_PKG_PYTHON_SETUPTOOLS_ENV = \
PATH=$(BR_PATH) \
PYTHONNOUSERSITE=1 \
SETUPTOOLS_USE_DISTUTILS=stdlib \
$(HOST_CONFIGURE_OPTS)
HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \