diff mbox series

package/pkg-python: use SETUPTOOLS_USE_DISTUTILS=stdlib

Message ID 20220224154118.220408-1-romain.naour@gmail.com
State Accepted
Headers show
Series package/pkg-python: use SETUPTOOLS_USE_DISTUTILS=stdlib | expand

Commit Message

Romain Naour Feb. 24, 2022, 3:41 p.m. UTC
-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] https://github.com/pypa/setuptools/commit/b6fcbbd00cb6d5607c9272dec452a50457bdb292
[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>
---
 package/pkg-python.mk | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Romain Naour Feb. 25, 2022, 9:52 p.m. UTC | #1
Le 24/02/2022 à 16:41, Romain Naour a écrit :
> -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] https://github.com/pypa/setuptools/commit/b6fcbbd00cb6d5607c9272dec452a50457bdb292
> [2] https://github.com/pypa/setuptools/blob/v60.0.0/CHANGES.rst#breaking-changes

I noticed that Qemu included a workaround for setuptools >= 60:

https://git.qemu.org/?p=qemu.git;a=commitdiff;h=762c280d5f3c17a239204a73855d8778f6dc2113

Best regards,
Romain

> 
> Signed-off-by: Romain Naour <romain.naour@gmail.com>
> Cc: James Hilliard <james.hilliard1@gmail.com>
> ---
>  package/pkg-python.mk | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/pkg-python.mk b/package/pkg-python.mk
> index b8dc9cd9e5..e81a1a3102 100644
> --- a/package/pkg-python.mk
> +++ b/package/pkg-python.mk
> @@ -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 = \
Peter Korsgaard March 7, 2022, 7:39 p.m. UTC | #2
>>>>> "Romain" == Romain Naour <romain.naour@gmail.com> writes:

 > -sh: ipython: not found
 > ipython use a wrong shebang on the target:

It looks like git ate your '# ' line, so I've added

 # ipython -c 'import math; math.floor(12.3)'

And committed, thanks.

 >  # 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] https://github.com/pypa/setuptools/commit/b6fcbbd00cb6d5607c9272dec452a50457bdb292
 > [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>
 > ---
 >  package/pkg-python.mk | 4 ++++
 >  1 file changed, 4 insertions(+)

 > diff --git a/package/pkg-python.mk b/package/pkg-python.mk
 > index b8dc9cd9e5..e81a1a3102 100644
 > --- a/package/pkg-python.mk
 > +++ b/package/pkg-python.mk
 > @@ -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 = \
 > -- 

 > 2.35.1

 > _______________________________________________
 > buildroot mailing list
 > buildroot@buildroot.org
 > https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index b8dc9cd9e5..e81a1a3102 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -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 = \