Skip to contentSkip to conversation

package/pkg-python: use SETUPTOOLS_USE_DISTUTILS=stdlib

PATCH In review Romain Naour 2 participants 3 messages Feb 24, 2022 – Mar 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-python: use SETUPTOOLS_USE_DISTUTILS=stdlib

-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

Cc James Hilliard <[email protected]>
---
 package/pkg-python.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/pkg-python.mk +4 -0
index b8dc9cd9e5..e81a1a3102 100644
@@ -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 = \
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Le 24/02/2022 à 16:41, Romain Naour a écrit :

Quoted 14 lines

-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.

Quoted 7 lines

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

Quoted 36 lines
Cc James Hilliard <[email protected]>
---
 package/pkg-python.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/pkg-python.mk +3 -0
index b8dc9cd9e5..e81a1a3102 100644
@@ -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

package/pkg-python.mk PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \ · line 105

Quoted 7 lines
package/pkg-python.mk +1 -0
@@ -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 = \

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Romain Naour
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Romain" == Romain Naour <[email protected]> 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.

Quoted 68 lines
 # 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

Cc James Hilliard <[email protected]>
---
 package/pkg-python.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/pkg-python.mk +4 -0
index b8dc9cd9e5..e81a1a3102 100644
@@ -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 = \
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot