summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRoss Burton <ross@burtonini.com>2022-03-16 18:32:37 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-03-17 16:44:33 +0000
commit4f22a746d8b76066940dd7f8bf18a3e240d24c73 (patch)
tree179515f96a21a2616d7e2bcf4a90b2f0b699f64a /meta/classes
parent11c36d4f1af0a461dc0d279f0ba1ca0a2ddf2356 (diff)
downloadpoky-4f22a746d8b76066940dd7f8bf18a3e240d24c73.tar.gz
classes/python_pep517: implement a standard do_compile
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. (From OE-Core rev: 862f68f3a05ce48834f4903d9f9a213684061779) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/python_pep517.bbclass13
1 files changed, 12 insertions, 1 deletions
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"
6# Where to execute the build process from 6# Where to execute the build process from
7PEP517_SOURCE_PATH ?= "${S}" 7PEP517_SOURCE_PATH ?= "${S}"
8 8
9# The PEP517 build API entry point
10PEP517_BUILD_API ?= "unset"
11
9# The directory where wheels should be written too. Build classes 12# The directory where wheels should be written too. Build classes
10# will ideally [cleandirs] this but we don't do that here in case 13# will ideally [cleandirs] this but we don't do that here in case
11# a recipe wants to install prebuilt wheels. 14# a recipe wants to install prebuilt wheels.
@@ -16,6 +19,14 @@ PEP517_INSTALL_PYTHON:class-native = "nativepython3"
16 19
17INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0" 20INSTALL_WHEEL_COMPILE_BYTECODE ?= "--compile-bytecode=0"
18 21
22# When we have Python 3.11 we can parse pyproject.toml to determine the build
23# API entry point directly
24python_pep517_do_compile () {
25 cd ${PEP517_SOURCE_PATH}
26 nativepython3 -c "import ${PEP517_BUILD_API} as api; api.build_wheel('${PEP517_WHEEL_PATH}')"
27}
28do_compile[cleandirs] += "${PEP517_WHEEL_PATH}"
29
19python_pep517_do_install () { 30python_pep517_do_install () {
20 COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l) 31 COUNT=$(find ${PEP517_WHEEL_PATH} -name '*.whl' | wc -l)
21 if test $COUNT -eq 0; then 32 if test $COUNT -eq 0; then
@@ -33,4 +44,4 @@ python_pep517_do_bootstrap_install () {
33 unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl 44 unzip -d ${D}${PYTHON_SITEPACKAGES_DIR} ${PEP517_WHEEL_PATH}/*.whl
34} 45}
35 46
36EXPORT_FUNCTIONS do_install 47EXPORT_FUNCTIONS do_compile do_install