All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] poetry-core: clean up class
@ 2022-03-08 19:42 Ross Burton
  2022-03-08 19:42 ` [PATCH 2/2] python3-poetry-core: self-bootstrap Ross Burton
  0 siblings, 1 reply; 2+ messages in thread
From: Ross Burton @ 2022-03-08 19:42 UTC (permalink / raw)
  To: openembedded-devel

There's been a lot of work on this class so clean it up a bit.

Rationalise imports, python3-dir is already included in python3native.

Don't write a helper script in do_configure, just call the API in
do_compile.  In the long term this should be using pypa/build instead
of calling the API directly.

Stub out do_configure as the base configure isn't useful.

Write the wheel to PIP_INSTALL_DIST_PATH instead of hard-coding S/dist,
and clean it.

Use EXPORT_FUNCTIONS on the tasks.

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

diff --git a/meta-python/classes/poetry_core.bbclass b/meta-python/classes/poetry_core.bbclass
index 4b3f9631e2..fb37c78c78 100644
--- a/meta-python/classes/poetry_core.bbclass
+++ b/meta-python/classes/poetry_core.bbclass
@@ -1,15 +1,15 @@
-inherit pip_install_wheel python3native python3-dir setuptools3-base
+inherit pip_install_wheel python3native setuptools3-base
 
-DEPENDS += "python3 python3-poetry-core-native python3-pip-native"
+DEPENDS += "python3-poetry-core-native"
 
-do_configure () {
-    mkdir -p ${S}/dist
-    cat > ${S}/build-it.py << EOF
-from poetry.core.masonry import api
-api.build_wheel('${S}/dist')
-EOF
+poetry_core_do_configure () {
+    :
 }
 
-do_compile () {
-    ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${S}/build-it.py
+# TODO: ideally this uses pypa/build
+poetry_core_do_compile () {
+    nativepython3 -c "from poetry.core.masonry import api; api.build_wheel('${PIP_INSTALL_DIST_PATH}')"
 }
+do_compile[cleandirs] += "${PIP_INSTALL_DIST_PATH}"
+
+EXPORT_FUNCTIONS do_configure do_compile
-- 
2.25.1



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

* [PATCH 2/2] python3-poetry-core: self-bootstrap
  2022-03-08 19:42 [PATCH 1/2] poetry-core: clean up class Ross Burton
@ 2022-03-08 19:42 ` Ross Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Burton @ 2022-03-08 19:42 UTC (permalink / raw)
  To: openembedded-devel

Poetry can bootstrap itself, so just inherit poetry_core.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../python/python3-poetry-core_1.0.8.bb           | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/meta-python/recipes-devtools/python/python3-poetry-core_1.0.8.bb b/meta-python/recipes-devtools/python/python3-poetry-core_1.0.8.bb
index 8ac9ed2be3..99ec763c4d 100644
--- a/meta-python/recipes-devtools/python/python3-poetry-core_1.0.8.bb
+++ b/meta-python/recipes-devtools/python/python3-poetry-core_1.0.8.bb
@@ -21,7 +21,8 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=104d5c3c653aeededf4076773aa4c236 \
 
 SRC_URI[sha256sum] = "951fc7c1f8d710a94cb49019ee3742125039fc659675912ea614ac2aa405b118"
 
-inherit pip_install_wheel python3native python3-dir pypi setuptools3-base
+inherit poetry_core pypi
+
 PIP_INSTALL_PACKAGE = "poetry_core"
 
 RDEPENDS:${PN}:append:class-target = "\
@@ -42,16 +43,4 @@ RDEPENDS:${PN} += "\
     python3-six \
 "
 
-do_configure () {
-    mkdir -p ${B}/dist
-    cat > ${B}/build-it.py << EOF
-from poetry.core.masonry import api
-api.build_wheel('${B}/dist')
-EOF 
-}
-
-do_compile () {
-    ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} ${B}/build-it.py
-}
-
 BBCLASSEXTEND = "native nativesdk"
-- 
2.25.1



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

end of thread, other threads:[~2022-03-08 19:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 19:42 [PATCH 1/2] poetry-core: clean up class Ross Burton
2022-03-08 19:42 ` [PATCH 2/2] python3-poetry-core: self-bootstrap 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.