All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v7 1/5] package/pkg-python: migrate flit to new bootstrapping sequence
@ 2022-04-24 21:39 James Hilliard
  2022-04-24 21:39 ` [Buildroot] [PATCH v7 2/5] package/pkg-python.mk: remove hardcoded paths for host Python James Hilliard
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: James Hilliard @ 2022-04-24 21:39 UTC (permalink / raw)
  To: buildroot; +Cc: Asaf Kahlon, James Hilliard, Thomas Petazzoni, Yann E . MORIN

There are a number of flit toolchain dependencies currently in the
process of deprecating distutils based fallbacks.

This will be needed in order to update tomli.

We need to migrate these to use a new bootstrap based build+install
sequence which relies on flit's bootstrap wheel build+install
features to build and install host-python-pypa-build and
host-python-installer which gives us a full pep517 toolchain.

Note that one can run host-python-flit-core commands for building
and installing itself since the package build directory is the cwd.

We need to add a special flit-bootstrap SETUP_TYPE for dependencies
of host-python-pypa-build and host-python-installer which can not
use the normal flit SETUP_TYPE which would cause a circular dependency
issue.

We need to special case dependency exclusions for
host-python-flit-core and host-python-installer to avoid circular
dependencies in the flit-bootstrap SETUP_TYPE.

We also need to special case the installation command for
host-python-flit-core since it can not depend on host-python-installer
due to host-python-installer requiring host-python-flit-core.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
Changes v3 -> v4:
  - rebase
Changes v2 -> v3:
  - add special flit-bootstrap SETUP_TYPE
  - don't change package SETUP_TYPE's yet
Changes v1 -> v2:
  - formatting/cleanup
  - add comments
---
 package/pkg-python.mk | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index 867341fc7b..2e7704a0a9 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -154,6 +154,9 @@ HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
 	--scripts=$(HOST_DIR)/bin \
 	--data=$(HOST_DIR)
 
+HOST_PKG_PYTHON_PEP517_BOOTSTRAP_INSTALL_OPTS = \
+	--installdir=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages
+
 ################################################################################
 # inner-python-package -- defines how the configuration, compilation
 # and installation of a Python package should be done, implements a
@@ -203,7 +206,7 @@ $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV)
 $(2)_BASE_BUILD_CMD = setup.py build
 $(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
 endif
-else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+else ifneq ($$(filter flit flit-bootstrap pep517,$$($(2)_SETUP_TYPE)),)
 ifeq ($(4),target)
 $(2)_BASE_ENV = $$(PKG_PYTHON_PEP517_ENV)
 $(2)_BASE_BUILD_CMD = -m build -n -w
@@ -211,9 +214,24 @@ $(2)_BASE_INSTALL_TARGET_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $
 $(2)_BASE_INSTALL_STAGING_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(PKG_PYTHON_PEP517_INSTALL_STAGING_OPTS)
 else
 $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_PEP517_ENV)
+# Use flit built in wheel builder for packages that are flit-bootstrap packages.
+# This is needed to avoid a circular with host-python-pypa-build and those dependencies.
+#
+ifeq ($$($(2)_SETUP_TYPE),flit-bootstrap)
+$(2)_BASE_BUILD_CMD = -m flit_core.wheel
+ifeq ($(1),host-python-flit-core)
+# Use flit built in bootstrap_install for installing host-python-flit-core.
+# This is due to host-python-installer depending on host-python-flit-core.
+#
+$(2)_BASE_INSTALL_CMD = -m bootstrap_install dist/* $$(HOST_PKG_PYTHON_PEP517_BOOTSTRAP_INSTALL_OPTS)
+else
+$(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+endif
+else
 $(2)_BASE_BUILD_CMD = -m build -n -w
 $(2)_BASE_INSTALL_CMD = $(TOPDIR)/support/scripts/pyinstaller.py dist/* $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
 endif
+endif
 else
 $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'pep517' or 'flit'.")
 endif
@@ -239,6 +257,12 @@ $(2)_DEPENDENCIES += host-python-pypa-build host-python-installer
 ifeq ($$($(2)_SETUP_TYPE),flit)
 $(2)_DEPENDENCIES += host-python-flit-core
 endif
+else ifeq ($$($(2)_SETUP_TYPE),flit-bootstrap)
+ifneq ($$(filter host-python-flit-core host-python-installer,$(1)),)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-flit-core,$(1)),,host-python-flit-core)
+else
+$(2)_DEPENDENCIES += host-python-flit-core host-python-installer
+endif
 endif # SETUP_TYPE
 
 # Python interpreter to use for building the package.
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-04-29 20:04 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-24 21:39 [Buildroot] [PATCH v7 1/5] package/pkg-python: migrate flit to new bootstrapping sequence James Hilliard
2022-04-24 21:39 ` [Buildroot] [PATCH v7 2/5] package/pkg-python.mk: remove hardcoded paths for host Python James Hilliard
2022-04-25 21:32   ` Arnout Vandecappelle
2022-04-24 21:39 ` [Buildroot] [PATCH v7 3/5] package/python-flit-core: migrate setup type to flit bootstrap James Hilliard
2022-04-25 21:34   ` Arnout Vandecappelle
2022-04-24 21:39 ` [Buildroot] [PATCH v7 4/5] package/python-tomli: bump to version 2.0.1 James Hilliard
2022-04-25 21:37   ` Arnout Vandecappelle
2022-04-26  1:35     ` James Hilliard
2022-04-27  7:07       ` Arnout Vandecappelle
2022-04-27  7:15         ` James Hilliard
2022-04-29 20:04           ` James Hilliard
2022-04-24 21:39 ` [Buildroot] [PATCH v7 5/5] package/python-pyparsing: bump to version 3.0.8 James Hilliard
2022-04-25 21:38   ` Arnout Vandecappelle
2022-04-25 21:32 ` [Buildroot] [PATCH v7 1/5] package/pkg-python: migrate flit to new bootstrapping sequence Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.