poetry-core: clean up class
PATCH 1/2 poetry-core: clean up class
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 <[email protected]>
--- meta-python/classes/poetry_core.bbclass | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
meta-python/classes/poetry_core.bbclass +10 -10
@@ -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
Signature · 1 line
2.25.1
PATCH 2/2 python3-poetry-core: self-bootstrap
Poetry can bootstrap itself, so just inherit poetry_core.
Signed-off-by Ross Burton <[email protected]>
--- .../python/python3-poetry-core_1.0.8.bb | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
meta-python/recipes-devtools/python/python3-poetry-core_1.0.8.bb +2 -13
@@ -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"
Signature · 1 line
2.25.1