Skip to contentSkip to conversation

package/python-flit-core: new package/infrastructure

PATCH In review James Hilliard 2 participants 3 messages Feb 12, 2022 – Feb 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 package/python-flit-core: new package/infrastructure

This adds pep517(needed for flit-core to build itself) and flit python package types.

We need to add an installer script and pass it appropriate options for installing pep517 wheels generated by python-pypa-build during the build stage. Unfortunately it seems pep517 does not support builds without using the wheel format.

We also need to add a patch fixing the version parser in flit-core.

---
Changes v1 -> v2:
- rebase on master

---
 package/pkg-python.mk                         | 99 +++++++++++++++++++
 ...sion-parser-for-multiple-assignments.patch | 80 +++++++++++++++
 .../python-flit-core/python-flit-core.hash    |  3 +
 package/python-flit-core/python-flit-core.mk  | 15 +++
 support/scripts/pyinstaller.py                | 69 +++++++++++++
 5 files changed, 266 insertions(+)
 create mode 100644 package/python-flit-core/0001-Fix-ast-version-parser-for-multiple-assignments.patch
 create mode 100644 package/python-flit-core/python-flit-core.hash
 create mode 100644 package/python-flit-core/python-flit-core.mk
 create mode 100755 support/scripts/pyinstaller.py
package/pkg-python.mk +99 -0
index bf0649fc9c..d574bfa2b0 100644
@@ -94,6 +94,47 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
 	--root=/ \
 	--single-version-externally-managed
 
+# Target pep517-based packages
+PKG_PYTHON_PEP517_ENV = \
+	_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \
+	PATH=$(BR_PATH) \
+	$(TARGET_CONFIGURE_OPTS) \
+	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \
+	PYTHONNOUSERSITE=1 \
+	_python_sysroot=$(STAGING_DIR) \
+	_python_prefix=/usr \
+	_python_exec_prefix=/usr
+
+PKG_PYTHON_PEP517_INSTALL_TARGET_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(TARGET_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(TARGET_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(TARGET_DIR)/usr/bin \
+    --data=$(TARGET_DIR)/usr
+
+PKG_PYTHON_PEP517_INSTALL_STAGING_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(STAGING_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(STAGING_DIR)/usr/bin \
+    --data=$(STAGING_DIR)/usr
+
+# Host pep517-based packages
+HOST_PKG_PYTHON_PEP517_ENV = \
+	PATH=$(BR_PATH) \
+	PYTHONNOUSERSITE=1 \
+	$(HOST_CONFIGURE_OPTS)
+
+HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(HOST_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(HOST_DIR)/usr/bin \
+    --data=$(HOST_DIR)/usr
+
 ################################################################################
 # inner-python-package -- defines how the configuration, compilation
 # and installation of a Python package should be done, implements a
@@ -143,6 +184,19 @@ $(2)_BASE_ENV         = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV)
 $(2)_BASE_BUILD_TGT   = build
 $(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
 endif
+else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+ifeq ($(4),target)
+$(2)_BASE_ENV         = $$(PKG_PYTHON_PEP517_ENV)
+$(2)_BASE_BUILD_TGT   = -w
+$(2)_BASE_BUILD_OPTS   =
+$(2)_BASE_INSTALL_TARGET_OPTS  = $$(PKG_PYTHON_PEP517_INSTALL_TARGET_OPTS)
+$(2)_BASE_INSTALL_STAGING_OPTS = $$(PKG_PYTHON_PEP517_INSTALL_STAGING_OPTS)
+else
+$(2)_BASE_ENV         = $$(HOST_PKG_PYTHON_PEP517_ENV)
+$(2)_BASE_BUILD_TGT   = -w
+$(2)_BASE_BUILD_OPTS   =
+$(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+endif
 else
 $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils' or 'setuptools'")
 endif
@@ -163,6 +217,12 @@ endif # ($(4),target)
 #
 ifeq ($$($(2)_SETUP_TYPE),setuptools)
 $(2)_DEPENDENCIES += $$(if $$(filter host-python-setuptools,$(1)),,host-python-setuptools)
+else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-pypa-build,$(1)),,host-python-pypa-build)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-installer,$(1)),,host-python-installer)
+ifeq ($$($(2)_SETUP_TYPE),flit)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-flit-core,$(1)),,host-python-flit-core)
+endif
 endif # SETUP_TYPE
 
 # Python interpreter to use for building the package.
@@ -174,6 +234,15 @@ $(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
 # file.
 #
 ifndef $(2)_BUILD_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_BUILD_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) -m build -n \
+		$$($$(PKG)_BASE_BUILD_TGT) \
+		$$($$(PKG)_BASE_BUILD_OPTS) $$($$(PKG)_BUILD_OPTS))
+endef
+else
 define $(2)_BUILD_CMDS
 	(cd $$($$(PKG)_BUILDDIR)/; \
 		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
@@ -182,12 +251,21 @@ define $(2)_BUILD_CMDS
 		$$($$(PKG)_BASE_BUILD_OPTS) $$($$(PKG)_BUILD_OPTS))
 endef
 endif
+endif
 
 #
 # Host installation step. Only define it if not already defined by the
 # package .mk file.
 #
 ifndef $(2)_INSTALL_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_INSTALL_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) $(TOPDIR)/support/scripts/pyinstaller.py dist/* \
+		$$($$(PKG)_BASE_INSTALL_OPTS) $$($$(PKG)_INSTALL_OPTS))
+endef
+else
 define $(2)_INSTALL_CMDS
 	(cd $$($$(PKG)_BUILDDIR)/; \
 		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
@@ -195,12 +273,22 @@ define $(2)_INSTALL_CMDS
 		$$($$(PKG)_BASE_INSTALL_OPTS) $$($$(PKG)_INSTALL_OPTS))
 endef
 endif
+endif
 
 #
 # Target installation step. Only define it if not already defined by
 # the package .mk file.
 #
 ifndef $(2)_INSTALL_TARGET_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_INSTALL_TARGET_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) $(TOPDIR)/support/scripts/pyinstaller.py dist/* \
+		$$($$(PKG)_BASE_INSTALL_TARGET_OPTS) \
+		$$($$(PKG)_INSTALL_TARGET_OPTS))
+endef
+else
 define $(2)_INSTALL_TARGET_CMDS
 	(cd $$($$(PKG)_BUILDDIR)/; \
 		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
@@ -209,12 +297,22 @@ define $(2)_INSTALL_TARGET_CMDS
 		$$($$(PKG)_INSTALL_TARGET_OPTS))
 endef
 endif
+endif
 
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
 #
 ifndef $(2)_INSTALL_STAGING_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_INSTALL_STAGING_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) $(TOPDIR)/support/scripts/pyinstaller.py dist/* \
+		$$($$(PKG)_BASE_INSTALL_STAGING_OPTS) \
+		$$($$(PKG)_INSTALL_STAGING_OPTS))
+endef
+else
 define $(2)_INSTALL_STAGING_CMDS
 	(cd $$($$(PKG)_BUILDDIR)/; \
 		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
@@ -223,6 +321,7 @@ define $(2)_INSTALL_STAGING_CMDS
 		$$($$(PKG)_INSTALL_STAGING_OPTS))
 endef
 endif
+endif
 
 # Call the generic package infrastructure to generate the necessary
 # make targets
package/python-flit-core/0001-Fix-ast-version-parser-for-multiple-assignments.patch new file +80 -0

80 lines not on this page · raw message

package/python-flit-core/python-flit-core.hash new file +3 -0
new file mode 100644
index 0000000000..bd47fd4f6b
@@ -0,0 +1,3 @@
+# md5, sha256 from https://pypi.org/pypi/flit_core/json
+md5  82143536b81f148851a0213305838e53  flit_core-3.6.0.tar.gz
+sha256  5892962ab8b8ea945835b3a288fe9dd69316f1903d5288c3f5cafdcdd04756ad  flit_core-3.6.0.tar.gz
package/python-flit-core/python-flit-core.mk new file +15 -0
new file mode 100644
index 0000000000..539a6c99fe
@@ -0,0 +1,15 @@
+################################################################################
+#
+# python-flit-core
+#
+################################################################################
+
+PYTHON_FLIT_CORE_VERSION = 3.6.0
+PYTHON_FLIT_CORE_SOURCE = flit_core-$(PYTHON_FLIT_CORE_VERSION).tar.gz
+PYTHON_FLIT_CORE_SITE = https://files.pythonhosted.org/packages/08/e9/0653f7783ba2ec2f954f19442878427f1d5bfccb01842d354453c2809b22
+PYTHON_FLIT_CORE_SETUP_TYPE = pep517
+PYTHON_FLIT_CORE_LICENSE = BSD-3-Clause
+HOST_PYTHON_FLIT_CORE_NEEDS_HOST_PYTHON = python3
+HOST_PYTHON_FLIT_CORE_DEPENDENCIES = host-python-pypa-build
+
+$(eval $(host-python-package))
support/scripts/pyinstaller.py new file +69 -0

69 lines not on this page · raw message

Signature · 6 lines
2.25.1

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

PATCH v3 2/2 package/python-tinycss2: bump to version 1.1.1

This update drops distutils support and requires flit package infrastructure.

---
Changes v2 -> v3:
- add python-tinycss2 back in series

---
 package/python-tinycss2/Config.in            | 2 ++
 package/python-tinycss2/python-tinycss2.hash | 4 ++--
 package/python-tinycss2/python-tinycss2.mk   | 6 +++---
 3 files changed, 7 insertions(+), 5 deletions(-)
package/python-tinycss2/Config.in +2 -0
index e6c992b8c5..e7a5bb3659 100644
@@ -4,3 +4,5 @@ config BR2_PACKAGE_PYTHON_TINYCSS2
 	select BR2_PACKAGE_PYTHON_WEBENCODINGS # runtime
 	help
 	  A tiny CSS parser.
+
+	  https://www.courtbouillon.org/tinycss2
package/python-tinycss2/python-tinycss2.hash +2 -2
index eeb3754752..e8e1d93f83 100644
@@ -1,5 +1,5 @@
 # md5, sha256 from https://pypi.org/pypi/tinycss2/json
-md5  7caf513c4e87fc2449dcfbf407a8416f  tinycss2-1.1.0.tar.gz
-sha256  fbdcac3044d60eb85fdb2aa840ece43cf7dbe798e373e6ee0be545d4d134e18a  tinycss2-1.1.0.tar.gz
+md5  60272f58f8d5834b2e09ffbc9bd5de53  tinycss2-1.1.1.tar.gz
+sha256  b2e44dd8883c360c35dd0d1b5aad0b610e5156c2cb3b33434634e539ead9d8bf  tinycss2-1.1.1.tar.gz
 # Locally computed sha256 checksums
 sha256  6b94acee20ec9f2709333134f3ba70322535fb420af0ce8c1455d9cbe297f1d5  LICENSE
package/python-tinycss2/python-tinycss2.mk +3 -3
index 4bf5b97766..e4fc5dc9c5 100644
@@ -4,10 +4,10 @@
 #
 ################################################################################
 
-PYTHON_TINYCSS2_VERSION = 1.1.0
+PYTHON_TINYCSS2_VERSION = 1.1.1
 PYTHON_TINYCSS2_SOURCE = tinycss2-$(PYTHON_TINYCSS2_VERSION).tar.gz
-PYTHON_TINYCSS2_SITE = https://files.pythonhosted.org/packages/ce/d3/ece7a98d5826bd134e269a3a3030153d30482194fca71d95a3041812aab8
-PYTHON_TINYCSS2_SETUP_TYPE = distutils
+PYTHON_TINYCSS2_SITE = https://files.pythonhosted.org/packages/1e/5a/576828164b5486f319c4323915b915a8af3fa4a654bbb6f8fc8e87b5cb17
+PYTHON_TINYCSS2_SETUP_TYPE = flit
 PYTHON_TINYCSS2_LICENSE = BSD-3-Clause
 PYTHON_TINYCSS2_LICENSE_FILES = LICENSE
 
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to James Hilliard

Hi James,

Both applied to next, but with modifications.

Quoted 7 lines · James Hilliard

This adds pep517(needed for flit-core to build itself) and flit python package types.

We need to add an installer script and pass it appropriate options for installing pep517 wheels generated by python-pypa-build during the build stage. Unfortunately it seems pep517 does not support builds without using the wheel format.

The installer script is not super nice. We could instead use host-python-pip,
but this works as well, so OK.

Quoted 23 lines

We also need to add a patch fixing the version parser in flit-core.

---
Changes v1 -> v2:
- rebase on master

---
  package/pkg-python.mk                         | 99 +++++++++++++++++++
  ...sion-parser-for-multiple-assignments.patch | 80 +++++++++++++++
  .../python-flit-core/python-flit-core.hash    |  3 +
  package/python-flit-core/python-flit-core.mk  | 15 +++
  support/scripts/pyinstaller.py                | 69 +++++++++++++
  5 files changed, 266 insertions(+)

create mode 100644 package/python-flit-core/0001-Fix-ast-version-parser-for-multiple-assignments.patch create mode 100644 package/python-flit-core/python-flit-core.hash
create mode 100644 package/python-flit-core/python-flit-core.mk
create mode 100755 support/scripts/pyinstaller.py

package/pkg-python.mk +0 -0
index bf0649fc9c..d574bfa2b0 100644

package/pkg-python.mk HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ · line 99

Quoted 6 lines
package/pkg-python.mk +3 -0
@@ -94,6 +94,47 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
  	--root=/ \
  	--single-version-externally-managed
 
+# Target pep517-based packages
+PKG_PYTHON_PEP517_ENV = \
+	_PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \

Indentation is with tab, not spaces. check-package doesn't warn about it
because there are some remaining spaces for indenting conditions.

package/pkg-python.mk HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ · line 102

Quoted 3 lines
package/pkg-python.mk +3 -0
+	PATH=$(BR_PATH) \
+	$(TARGET_CONFIGURE_OPTS) \
+	PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \

With the removal of python2, PYTHON_PATH should no longer be used. And this
setup type is anyway python3 only.

Quoted 39 lines
package/pkg-python.mk +35 -0
+	PYTHONNOUSERSITE=1 \
+	_python_sysroot=$(STAGING_DIR) \
+	_python_prefix=/usr \
+	_python_exec_prefix=/usr
+
+PKG_PYTHON_PEP517_INSTALL_TARGET_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(TARGET_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(TARGET_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(TARGET_DIR)/usr/bin \
+    --data=$(TARGET_DIR)/usr
+
+PKG_PYTHON_PEP517_INSTALL_STAGING_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(STAGING_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(STAGING_DIR)/usr/bin \
+    --data=$(STAGING_DIR)/usr
+
+# Host pep517-based packages
+HOST_PKG_PYTHON_PEP517_ENV = \
+	PATH=$(BR_PATH) \
+	PYTHONNOUSERSITE=1 \
+	$(HOST_CONFIGURE_OPTS)
+
+HOST_PKG_PYTHON_PEP517_INSTALL_OPTS = \
+    --interpreter=/usr/bin/python \
+    --script-kind=posix \
+    --purelib=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages \
+    --headers=$(HOST_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)  \
+    --scripts=$(HOST_DIR)/usr/bin \
+    --data=$(HOST_DIR)/usr
+
  ################################################################################
  # inner-python-package -- defines how the configuration, compilation
  # and installation of a Python package should be done, implements a

package/pkg-python.mk $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) · line 191

Quoted 8 lines
package/pkg-python.mk +5 -0
@@ -143,6 +184,19 @@ $(2)_BASE_ENV         = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV)
  $(2)_BASE_BUILD_TGT   = build
  $(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
  endif
+else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+ifeq ($(4),target)
+$(2)_BASE_ENV         = $$(PKG_PYTHON_PEP517_ENV)
+$(2)_BASE_BUILD_TGT   = -w
+$(2)_BASE_BUILD_OPTS   =

No need to define empty variables.

package/pkg-python.mk $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) · line 201

Quoted 10 lines
package/pkg-python.mk +8 -0
+$(2)_BASE_INSTALL_TARGET_OPTS  = $$(PKG_PYTHON_PEP517_INSTALL_TARGET_OPTS)
+$(2)_BASE_INSTALL_STAGING_OPTS = $$(PKG_PYTHON_PEP517_INSTALL_STAGING_OPTS)
+else
+$(2)_BASE_ENV         = $$(HOST_PKG_PYTHON_PEP517_ENV)
+$(2)_BASE_BUILD_TGT   = -w
+$(2)_BASE_BUILD_OPTS   =
+$(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_PEP517_INSTALL_OPTS)
+endif
  else
  $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils' or 'setuptools'")

This should be extended with the new types.

package/pkg-python.mk endif # ($(4),target) · line 221

Quoted 7 lines
package/pkg-python.mk +2 -0
  endif
@@ -163,6 +217,12 @@ endif # ($(4),target)
  #
  ifeq ($$($(2)_SETUP_TYPE),setuptools)
  $(2)_DEPENDENCIES += $$(if $$(filter host-python-setuptools,$(1)),,host-python-setuptools)
+else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-pypa-build,$(1)),,host-python-pypa-build)

No need for this filtering. It's there for setuptools because setuptools uses
setup type setuptools itself, so it creates a circular dependency. pypa-build, installer and flit-core don't have that issue.

Quoted 8 lines
package/pkg-python.mk +4 -0
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-installer,$(1)),,host-python-installer)
+ifeq ($$($(2)_SETUP_TYPE),flit)
+$(2)_DEPENDENCIES += $$(if $$(filter host-python-flit-core,$(1)),,host-python-flit-core)
+endif
  endif # SETUP_TYPE
 
  # Python interpreter to use for building the package.

package/pkg-python.mk $(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python · line 243

Quoted 10 lines
package/pkg-python.mk +7 -0
@@ -174,6 +234,15 @@ $(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/python
  # file.
  #
  ifndef $(2)_BUILD_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_BUILD_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) -m build -n \
+		$$($$(PKG)_BASE_BUILD_TGT) \
+		$$($$(PKG)_BASE_BUILD_OPTS) $$($$(PKG)_BUILD_OPTS))

Repeating the build commands completely defeats the purpose of those
variables. Therefore, I've added an additional preparatory commit that moves the "-m build -n" part into the _BUILD_TGT variable. Check the git history to see how it's done.

Quoted 11 lines
package/pkg-python.mk +3 -0
+endef
+else
  define $(2)_BUILD_CMDS
  	(cd $$($$(PKG)_BUILDDIR)/; \
  		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
@@ -182,12 +251,21 @@ define $(2)_BUILD_CMDS
  		$$($$(PKG)_BASE_BUILD_OPTS) $$($$(PKG)_BUILD_OPTS))
  endef
  endif
+endif
 

package/pkg-python.mk define $(2)_BUILD_CMDS · line 265

Quoted 10 lines
package/pkg-python.mk +5 -0
  #
  # Host installation step. Only define it if not already defined by the
  # package .mk file.
  #
  ifndef $(2)_INSTALL_CMDS
+ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
+define $(2)_INSTALL_CMDS
+	(cd $$($$(PKG)_BUILDDIR)/; \
+		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
+		$$($(2)_PYTHON_INTERPRETER) $(TOPDIR)/support/scripts/pyinstaller.py dist/* \

I haven't changed this, but shouldn't this be dist/*.whl just to be safe?

Quoted 6 lines
package/pkg-python.mk +3 -0
+		$$($$(PKG)_BASE_INSTALL_OPTS) $$($$(PKG)_INSTALL_OPTS))
+endef
+else
  define $(2)_INSTALL_CMDS
  	(cd $$($$(PKG)_BUILDDIR)/; \
  		$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \

[snip]

Quoted 8 lines
package/python-flit-core/python-flit-core.mk new file +2 -0
new file mode 100644
index 0000000000..539a6c99fe
@@ -0,0 +1,15 @@
+################################################################################
+#

package/python-flit-core/python-flit-core.mk line 12

Quoted 10 lines
package/python-flit-core/python-flit-core.mk new file +10 -0
+# python-flit-core
+#
+################################################################################
+
+PYTHON_FLIT_CORE_VERSION = 3.6.0
+PYTHON_FLIT_CORE_SOURCE = flit_core-$(PYTHON_FLIT_CORE_VERSION).tar.gz
+PYTHON_FLIT_CORE_SITE = https://files.pythonhosted.org/packages/08/e9/0653f7783ba2ec2f954f19442878427f1d5bfccb01842d354453c2809b22
+PYTHON_FLIT_CORE_SETUP_TYPE = pep517
+PYTHON_FLIT_CORE_LICENSE = BSD-3-Clause
+HOST_PYTHON_FLIT_CORE_NEEDS_HOST_PYTHON = python3

No longer exists.

package/python-flit-core/python-flit-core.mk line 13

Quoted 1 line
package/python-flit-core/python-flit-core.mk new file +1 -0
+HOST_PYTHON_FLIT_CORE_DEPENDENCIES = host-python-pypa-build

This is now added automatically by the infra.

Regards,
Arnout

Quoted 22 lines
package/python-flit-core/python-flit-core.mk new file +2 -0
+
+$(eval $(host-python-package))
support/scripts/pyinstaller.py new file +14 -0
new file mode 100755
index 0000000000..6dd9242327
@@ -0,0 +1,69 @@
+#!/usr/bin/env python3
+
+import argparse
+import glob
+
+from installer import install
+from installer.destinations import SchemeDictionaryDestination
+from installer.sources import WheelFile
+
+
+def main():
+    """Entry point for CLI."""
+    ap = argparse.ArgumentParser("python pyinstaller.py")
+    ap.add_argument("wheel_file", help="Path to a .whl file to install")

support/scripts/pyinstaller.py line 24

Quoted 10 lines
support/scripts/pyinstaller.py new file +10 -0
+
+    ap.add_argument(
+        "--interpreter", required=True, help="Interpreter path to be used in scripts"
+    )
+    ap.add_argument(
+        "--script-kind",
+        required=True,
+        choices=["posix", "win-ia32", "win-amd64", "win-arm", "win-arm64"],
+        help="Kind of launcher to create for each script",
+    )

This is a bit more generic than what we need, which makes me think you copied
it from somewhere. If that is the case, you should include a copyright notice at the beginning of the file, including (very important) and SPDX license header. If you created it completely yourself, it's OK.

Regards,
Arnout

Quoted 35 lines
support/scripts/pyinstaller.py new file +35 -0
+
+    dest_args = ap.add_argument_group("Destination directories")
+    dest_args.add_argument(
+        "--purelib",
+        required=True,
+        help="Directory for platform-independent Python modules",
+    )
+    dest_args.add_argument(
+        "--platlib",
+        help="Directory for platform-dependent Python modules (same as purelib "
+        "if not specified)",
+    )
+    dest_args.add_argument(
+        "--headers", required=True, help="Directory for C header files"
+    )
+    dest_args.add_argument(
+        "--scripts", required=True, help="Directory for executable scripts"
+    )
+    dest_args.add_argument(
+        "--data", required=True, help="Directory for external data files"
+    )
+    args = ap.parse_args()
+
+    destination = SchemeDictionaryDestination(
+        {
+            "purelib": args.purelib,
+            "platlib": args.platlib if args.platlib is not None else args.purelib,
+            "headers": args.headers,
+            "scripts": args.scripts,
+            "data": args.data,
+        },
+        interpreter=args.interpreter,
+        script_kind=args.script_kind,
+    )
+

support/scripts/pyinstaller.py line 69

Quoted 10 lines
support/scripts/pyinstaller.py new file +10 -0
+    with WheelFile.open(glob.glob(args.wheel_file)[0]) as source:
+        install(
+            source=source,
+            destination=destination,
+            additional_metadata={},
+        )
+
+
+if __name__ == "__main__":
+    main()

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