All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS
@ 2022-03-16 18:32 Ross Burton
  2022-03-16 18:32 ` [PATCH 2/8] classes/python_pep517: implement a standard do_compile Ross Burton
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

setuptools_build_meta.bbclass already sets this dependency.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/python/python3-packaging_21.3.bb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3-packaging_21.3.bb b/meta/recipes-devtools/python/python3-packaging_21.3.bb
index c7d0cb7ef7..a81fd94d37 100644
--- a/meta/recipes-devtools/python/python3-packaging_21.3.bb
+++ b/meta/recipes-devtools/python/python3-packaging_21.3.bb
@@ -9,5 +9,4 @@ inherit pypi setuptools_build_meta
 
 BBCLASSEXTEND = "native nativesdk"
 
-DEPENDS += "${PYTHON_PN}-setuptools-native"
 RDEPENDS:${PN} += "${PYTHON_PN}-pyparsing"
-- 
2.25.1



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

* [PATCH 2/8] classes/python_pep517: implement a standard do_compile
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 3/8] classes/flit_core: use python_pep517_do_compile Ross Burton
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

As all PEP517-compliant build systems have a universal API, we can ask
that users of this class set PEP517_BUILD_API to the class that implements
this API and call it ourselves, instead of users needing to implement
near-identical do_compile tasks themselves.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/python_pep517.bbclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/meta/classes/python_pep517.bbclass b/meta/classes/python_pep517.bbclass
index ac7c1e44c6..83c6dcb5c7 100644
--- a/meta/classes/python_pep517.bbclass
+++ b/meta/classes/python_pep517.bbclass
@@ -6,6 +6,9 @@ DEPENDS:append = " python3-installer-native"
 # Where to execute the build process from
 PEP517_SOURCE_PATH ?= "${S}"
 
+# The PEP517 build API entry point
+PEP517_BUILD_API ?= "unset"
+
 # The directory where wheels should be written too. Build classes
 # will ideally [cleandirs] this but we don't do that here in case
 # a recipe wants to install prebuilt wheels.
@@ -16,6 +19,14 @@ PEP517_INSTALL_PYTHON:class-native = "nativepython3"
 
 INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
 
+# When we have Python 3.11 we can parse pyproject.toml to determine the build
+# API entry point directly
+python_pep517_do_compile () {
+    cd ${PEP517_SOURCE_PATH}
+    nativepython3 -c "import ${PEP517_BUILD_API} as api; api.build_wheel('${PEP517_WHEEL_PATH}')"
+}
+do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
+
 python_pep517_do_install () {
     COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l)
     if test $COUNT -eq 0; then
@@ -33,4 +44,4 @@ python_pep517_do_bootstrap_install () {
     unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
 }
 
-EXPORT_FUNCTIONS do_install
+EXPORT_FUNCTIONS do_compile do_install
-- 
2.25.1



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

* [PATCH 3/8] classes/flit_core: use python_pep517_do_compile
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
  2022-03-16 18:32 ` [PATCH 2/8] classes/python_pep517: implement a standard do_compile Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 4/8] classes/python_poetry_core: " Ross Burton
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

Instead of implementing our own do_compile, set PEP517_BUILD_API and
use the generic do_compile.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/flit_core.bbclass | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/meta/classes/flit_core.bbclass b/meta/classes/flit_core.bbclass
index 5a602f54ab..81fdf93e47 100644
--- a/meta/classes/flit_core.bbclass
+++ b/meta/classes/flit_core.bbclass
@@ -2,15 +2,10 @@ inherit python_pep517 python3native python3-dir setuptools3-base
 
 DEPENDS += "python3 python3-flit-core-native"
 
+PEP517_BUILD_API = "flit_core.buildapi"
+
 flit_core_do_configure () {
     :
 }
 
-# TODO: ideally this uses pypa/build
-flit_core_do_compile () {
-    cd ${PEP517_SOURCE_PATH}
-    nativepython3 -mflit_core.wheel --outdir ${PEP517_WHEEL_PATH}
-}
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-EXPORT_FUNCTIONS do_configure do_compile
+EXPORT_FUNCTIONS do_configure
-- 
2.25.1



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

* [PATCH 4/8] classes/python_poetry_core: use python_pep517_do_compile
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
  2022-03-16 18:32 ` [PATCH 2/8] classes/python_pep517: implement a standard do_compile Ross Burton
  2022-03-16 18:32 ` [PATCH 3/8] classes/flit_core: use python_pep517_do_compile Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 5/8] classes/setuptools_build_meta: " Ross Burton
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

Instead of implementing our own do_compile, set PEP517_BUILD_API and
use the generic do_compile.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/python_poetry_core.bbclass | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/meta/classes/python_poetry_core.bbclass b/meta/classes/python_poetry_core.bbclass
index 47b2fe46d5..3fecb6c6bb 100644
--- a/meta/classes/python_poetry_core.bbclass
+++ b/meta/classes/python_poetry_core.bbclass
@@ -2,14 +2,10 @@ inherit python_pep517 python3native setuptools3-base
 
 DEPENDS += "python3-poetry-core-native"
 
+PEP517_BUILD_API = "poetry.core.masonry.api"
+
 python_poetry_core_do_configure () {
     :
 }
 
-# TODO: ideally this uses pypa/build
-python_poetry_core_do_compile () {
-    nativepython3 -c "from poetry.core.masonry import api; api.build_wheel('${PEP517_WHEEL_PATH}')"
-}
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-EXPORT_FUNCTIONS do_configure do_compile
+EXPORT_FUNCTIONS do_configure
-- 
2.25.1



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

* [PATCH 5/8] classes/setuptools_build_meta: use python_pep517_do_compile
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
                   ` (2 preceding siblings ...)
  2022-03-16 18:32 ` [PATCH 4/8] classes/python_poetry_core: " Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 6/8] classes/python_pep517: add more comments Ross Burton
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

Instead of implementing our own do_compile, set PEP517_BUILD_API and
use the generic do_compile.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/setuptools_build_meta.bbclass | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/meta/classes/setuptools_build_meta.bbclass b/meta/classes/setuptools_build_meta.bbclass
index 8791a2965f..62b037363d 100644
--- a/meta/classes/setuptools_build_meta.bbclass
+++ b/meta/classes/setuptools_build_meta.bbclass
@@ -2,15 +2,10 @@ inherit setuptools3-base python_pep517
 
 DEPENDS += "python3-setuptools-native python3-wheel-native"
 
+PEP517_BUILD_API = "setuptools.build_meta"
+
 setuptools_build_meta_do_configure () {
     :
 }
 
-# TODO: ideally this uses pypa/build
-setuptools_build_meta_do_compile () {
-    cd ${PEP517_SOURCE_PATH}
-    nativepython3 -c "from setuptools import build_meta; build_meta.build_wheel('${PEP517_WHEEL_PATH}')"
-}
-do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
-
-EXPORT_FUNCTIONS do_configure do_compile
+EXPORT_FUNCTIONS do_configure
-- 
2.25.1



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

* [PATCH 6/8] classes/python_pep517: add more comments
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
                   ` (3 preceding siblings ...)
  2022-03-16 18:32 ` [PATCH 5/8] classes/setuptools_build_meta: " Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 7/8] classes/flit_core: rename to python_flit_core Ross Burton
  2022-03-16 18:32 ` [PATCH 8/8] classes/python_pep517: consolidate stub do_configure Ross Burton
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

Remove mention of prebuilt wheels, this is for the full PEP517 build
process and recipes that want to install prebuilt wheels can use
pypa/installer directly.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/python_pep517.bbclass | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/classes/python_pep517.bbclass b/meta/classes/python_pep517.bbclass
index 83c6dcb5c7..73bcf9ba07 100644
--- a/meta/classes/python_pep517.bbclass
+++ b/meta/classes/python_pep517.bbclass
@@ -1,5 +1,8 @@
 # Common infrastructure for Python packages that use PEP-517 compliant packaging.
 # https://www.python.org/dev/peps/pep-0517/
+#
+# This class will build a wheel in do_compile, and use pypa/installer to install
+# it in do_install.
 
 DEPENDS:append = " python3-installer-native"
 
@@ -9,14 +12,14 @@ PEP517_SOURCE_PATH ?= "${S}"
 # The PEP517 build API entry point
 PEP517_BUILD_API ?= "unset"
 
-# The directory where wheels should be written too. Build classes
-# will ideally [cleandirs] this but we don't do that here in case
-# a recipe wants to install prebuilt wheels.
+# The directory where wheels will be written
 PEP517_WHEEL_PATH ?= "${WORKDIR}/dist"
 
+# The interpreter to use for installed scripts
 PEP517_INSTALL_PYTHON = "python3"
 PEP517_INSTALL_PYTHON:class-native = "nativepython3"
 
+# pypa/installer option to control the bytecode compilation
 INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
 
 # When we have Python 3.11 we can parse pyproject.toml to determine the build
-- 
2.25.1



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

* [PATCH 7/8] classes/flit_core: rename to python_flit_core
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
                   ` (4 preceding siblings ...)
  2022-03-16 18:32 ` [PATCH 6/8] classes/python_pep517: add more comments Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  2022-03-16 18:32 ` [PATCH 8/8] classes/python_pep517: consolidate stub do_configure Ross Burton
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

To be more uniform with the other new Python classes, rename this to
python_flit_core and update the recipes that use it.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/{flit_core.bbclass => python_flit_core.bbclass} | 2 +-
 meta/recipes-devtools/python/python3-flit-core_3.7.1.bb      | 2 +-
 meta/recipes-devtools/python/python3-installer_0.5.1.bb      | 2 +-
 meta/recipes-devtools/python/python3-tomli_2.0.1.bb          | 2 +-
 meta/recipes-devtools/python/python3-wheel_0.37.1.bb         | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
 rename meta/classes/{flit_core.bbclass => python_flit_core.bbclass} (84%)

diff --git a/meta/classes/flit_core.bbclass b/meta/classes/python_flit_core.bbclass
similarity index 84%
rename from meta/classes/flit_core.bbclass
rename to meta/classes/python_flit_core.bbclass
index 81fdf93e47..eef361bb1b 100644
--- a/meta/classes/flit_core.bbclass
+++ b/meta/classes/python_flit_core.bbclass
@@ -4,7 +4,7 @@ DEPENDS += "python3 python3-flit-core-native"
 
 PEP517_BUILD_API = "flit_core.buildapi"
 
-flit_core_do_configure () {
+python_flit_core_do_configure () {
     :
 }
 
diff --git a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
index dc815acf08..8d107384a6 100644
--- a/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
+++ b/meta/recipes-devtools/python/python3-flit-core_3.7.1.bb
@@ -10,7 +10,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=41eb78fa8a872983a882c694a8305f08"
 
 SRC_URI[sha256sum] = "3c9bd9c140515bfe62dd938c6610d10d6efb9e35cc647fc614fe5fb3a5036682"
 
-inherit pypi flit_core
+inherit pypi python_flit_core
 
 # Need to install by hand as there's a dependency loop
 DEPENDS:remove:class-native = " python3-installer-native"
diff --git a/meta/recipes-devtools/python/python3-installer_0.5.1.bb b/meta/recipes-devtools/python/python3-installer_0.5.1.bb
index 12d9fce249..f4f9e1bde6 100644
--- a/meta/recipes-devtools/python/python3-installer_0.5.1.bb
+++ b/meta/recipes-devtools/python/python3-installer_0.5.1.bb
@@ -10,7 +10,7 @@ SRC_URI += "file://interpreter.patch"
 
 SRC_URI[sha256sum] = "f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445"
 
-inherit pypi flit_core
+inherit pypi python_flit_core
 
 DEPENDS:remove:class-native = "python3-installer-native"
 DEPENDS:append:class-native = " unzip-native"
diff --git a/meta/recipes-devtools/python/python3-tomli_2.0.1.bb b/meta/recipes-devtools/python/python3-tomli_2.0.1.bb
index f8b423bbef..6118a6a9c3 100644
--- a/meta/recipes-devtools/python/python3-tomli_2.0.1.bb
+++ b/meta/recipes-devtools/python/python3-tomli_2.0.1.bb
@@ -6,7 +6,7 @@ BUGTRACKER = "https://github.com/hukkin/tomli/issues"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=aaaaf0879d17df0110d1aa8c8c9f46f5"
 
-inherit pypi flit_core
+inherit pypi python_flit_core
 
 SRC_URI[sha256sum] = "de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
 
diff --git a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
index efd6c2f968..2f7dd122ba 100644
--- a/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
+++ b/meta/recipes-devtools/python/python3-wheel_0.37.1.bb
@@ -6,7 +6,7 @@ LIC_FILES_CHKSUM = "file://PKG-INFO;beginline=10;endline=10;md5=8227180126797a01
 
 SRC_URI[sha256sum] = "e9a504e793efbca1b8e0e9cb979a249cf4a0a7b5b8c9e8b65a5e39d49529c1c4"
 
-inherit flit_core pypi
+inherit python_flit_core pypi
 
 SRC_URI += " file://0001-Backport-pyproject.toml-from-flit-backend-branch.patch"
 
-- 
2.25.1



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

* [PATCH 8/8] classes/python_pep517: consolidate stub do_configure
  2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
                   ` (5 preceding siblings ...)
  2022-03-16 18:32 ` [PATCH 7/8] classes/flit_core: rename to python_flit_core Ross Burton
@ 2022-03-16 18:32 ` Ross Burton
  6 siblings, 0 replies; 8+ messages in thread
From: Ross Burton @ 2022-03-16 18:32 UTC (permalink / raw)
  To: openembedded-core

As PEP517 doesn't have an explicit configure step, we can stub out the
do_configure task once instead of the calling classes doing it.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes/python_flit_core.bbclass      | 6 ------
 meta/classes/python_pep517.bbclass         | 8 +++++++-
 meta/classes/python_poetry_core.bbclass    | 6 ------
 meta/classes/setuptools_build_meta.bbclass | 6 ------
 4 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/meta/classes/python_flit_core.bbclass b/meta/classes/python_flit_core.bbclass
index eef361bb1b..96652aa204 100644
--- a/meta/classes/python_flit_core.bbclass
+++ b/meta/classes/python_flit_core.bbclass
@@ -3,9 +3,3 @@ inherit python_pep517 python3native python3-dir setuptools3-base
 DEPENDS += "python3 python3-flit-core-native"
 
 PEP517_BUILD_API = "flit_core.buildapi"
-
-python_flit_core_do_configure () {
-    :
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/meta/classes/python_pep517.bbclass b/meta/classes/python_pep517.bbclass
index 73bcf9ba07..34ffdc9c0d 100644
--- a/meta/classes/python_pep517.bbclass
+++ b/meta/classes/python_pep517.bbclass
@@ -22,6 +22,12 @@ PEP517_INSTALL_PYTHON:class-native = "nativepython3"
 # pypa/installer option to control the bytecode compilation
 INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
 
+# PEP517 doesn't have a specific configure step, so set an empty do_configure to avoid
+# running base_do_configure.
+python_pep517_do_configure () {
+    :
+}
+
 # When we have Python 3.11 we can parse pyproject.toml to determine the build
 # API entry point directly
 python_pep517_do_compile () {
@@ -47,4 +53,4 @@ python_pep517_do_bootstrap_install () {
     unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
 }
 
-EXPORT_FUNCTIONS do_compile do_install
+EXPORT_FUNCTIONS do_configure do_compile do_install
diff --git a/meta/classes/python_poetry_core.bbclass b/meta/classes/python_poetry_core.bbclass
index 3fecb6c6bb..577663b8f1 100644
--- a/meta/classes/python_poetry_core.bbclass
+++ b/meta/classes/python_poetry_core.bbclass
@@ -3,9 +3,3 @@ inherit python_pep517 python3native setuptools3-base
 DEPENDS += "python3-poetry-core-native"
 
 PEP517_BUILD_API = "poetry.core.masonry.api"
-
-python_poetry_core_do_configure () {
-    :
-}
-
-EXPORT_FUNCTIONS do_configure
diff --git a/meta/classes/setuptools_build_meta.bbclass b/meta/classes/setuptools_build_meta.bbclass
index 62b037363d..b2bba35a0b 100644
--- a/meta/classes/setuptools_build_meta.bbclass
+++ b/meta/classes/setuptools_build_meta.bbclass
@@ -3,9 +3,3 @@ inherit setuptools3-base python_pep517
 DEPENDS += "python3-setuptools-native python3-wheel-native"
 
 PEP517_BUILD_API = "setuptools.build_meta"
-
-setuptools_build_meta_do_configure () {
-    :
-}
-
-EXPORT_FUNCTIONS do_configure
-- 
2.25.1



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

end of thread, other threads:[~2022-03-16 18:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16 18:32 [PATCH 1/8] python3-packaging: remove duplicate python3-setuptools-native DEPENDS Ross Burton
2022-03-16 18:32 ` [PATCH 2/8] classes/python_pep517: implement a standard do_compile Ross Burton
2022-03-16 18:32 ` [PATCH 3/8] classes/flit_core: use python_pep517_do_compile Ross Burton
2022-03-16 18:32 ` [PATCH 4/8] classes/python_poetry_core: " Ross Burton
2022-03-16 18:32 ` [PATCH 5/8] classes/setuptools_build_meta: " Ross Burton
2022-03-16 18:32 ` [PATCH 6/8] classes/python_pep517: add more comments Ross Burton
2022-03-16 18:32 ` [PATCH 7/8] classes/flit_core: rename to python_flit_core Ross Burton
2022-03-16 18:32 ` [PATCH 8/8] classes/python_pep517: consolidate stub do_configure Ross Burton

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.