Skip to contentSkip to conversation

package/pkg-python.mk: remove distutils support

Buildroot Thomas Petazzoni via buildroot 1 participant 1 message Feb 6, 2024

lore
Share & tools
lore
#0 lore raw

commit: https://git.buildroot.net/buildroot/commit/?id=09de823cbc7bd50a40e25f4166b4e42be94b0c7b
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

All Python packages have been migrated to a different setup type, and we're about to bump to Python 3.12 which no longer supports distutils, so let's drop support for distutils in our python-package infrastructure.

[Thomas: also update the Buildroot manual]
---
 docs/manual/adding-packages-directory.adoc |  4 +--
 docs/manual/adding-packages-python.adoc    | 46 ++++++++++++++----------------
 package/pkg-python.mk                      | 38 ++----------------------
 3 files changed, 26 insertions(+), 62 deletions(-)
docs/manual/adding-packages-directory.adoc +2 -2
index 5a0f298eb1..e994b7e1f6 100644
@@ -429,8 +429,8 @@ different way, using different infrastructures:
    and xref:cmake-package-reference[reference].
 
 * *Makefiles for Python modules*: We have a dedicated infrastructure
-   for Python modules that use the +distutils+, +flit+, +pep517+ or
-   +setuptools+ mechanisms. We cover them through a
+   for Python modules that use the +flit+, +pep517+ or +setuptools+
+   mechanisms. We cover them through a
    xref:python-package-tutorial[tutorial] and a
    xref:python-package-reference[reference].
 
docs/manual/adding-packages-python.adoc +22 -24

77 lines not on this page · raw message

package/pkg-python.mk +2 -36
index 4bed5a1835..94f28ff841 100644
@@ -52,40 +52,6 @@ HOST_PKG_PYTHON_ENV = \
 	PYTHONNOUSERSITE=1 \
 	$(HOST_CONFIGURE_OPTS)
 
-# Target distutils-based packages
-PKG_PYTHON_DISTUTILS_ENV = \
-	$(PKG_PYTHON_ENV) \
-	LDSHARED="$(TARGET_CROSS)gcc -shared"
-
-PKG_PYTHON_DISTUTILS_BUILD_CMD = \
-	setup.py build \
-	--executable=/usr/bin/python
-
-PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \
-	--install-headers=/usr/include/python$(PYTHON3_VERSION_MAJOR) \
-	--prefix=/usr
-
-PKG_PYTHON_DISTUTILS_INSTALL_TARGET_CMD = \
-	setup.py install --no-compile \
-	$(PKG_PYTHON_DISTUTILS_INSTALL_OPTS) \
-	--root=$(TARGET_DIR)
-
-PKG_PYTHON_DISTUTILS_INSTALL_STAGING_CMD = \
-	setup.py install \
-	$(PKG_PYTHON_DISTUTILS_INSTALL_OPTS) \
-	--root=$(STAGING_DIR)
-
-# Host distutils-based packages
-HOST_PKG_PYTHON_DISTUTILS_ENV = \
-	$(HOST_PKG_PYTHON_ENV)
-
-HOST_PKG_PYTHON_DISTUTILS_BUILD_CMD = \
-	setup.py build \
-
-HOST_PKG_PYTHON_DISTUTILS_INSTALL_CMD = \
-	setup.py install \
-	--prefix=$(HOST_DIR)
-
 # Target setuptools-based packages
 PKG_PYTHON_SETUPTOOLS_ENV = \
 	$(PKG_PYTHON_ENV)
@@ -287,8 +253,8 @@ endif
 
 $(2)_SETUP_TYPE_UPPER = $$(call UPPERCASE,$$($(2)_SETUP_TYPE))
 
-ifneq ($$(filter-out distutils setuptools setuptools-rust pep517 flit flit-bootstrap maturin,$$($(2)_SETUP_TYPE)),)
-$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'maturin', 'setuptools', 'setuptools-rust', 'pep517' or 'flit'.")
+ifneq ($$(filter-out setuptools setuptools-rust pep517 flit flit-bootstrap maturin,$$($(2)_SETUP_TYPE)),)
+$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'maturin', 'setuptools', 'setuptools-rust', 'pep517' or 'flit'.")
 endif
 ifeq ($(4)-$$($(2)_SETUP_TYPE),target-flit-bootstrap)
 $$(error flit-bootstrap setup type only supported for host packages)

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