[5/6] setuptools_build_meta: add variable to control where pyproject.toml is located

Message ID 20220308143035.3569559-5-ross.burton@arm.com
State Accepted, archived
Commit 891fab83683cf032d4849f2dfbcd03a3eb22f158
Headers show
Series [1/6] flit_core: respect PIP_INSTALL_DIST_PATH | expand

Commit Message

Ross Burton March 8, 2022, 2:30 p.m. UTC
The PEP517[1] pyproject.toml doesn't have to be located at the top-level
of the source tree (for example, in recipes with multiple components), so
add a variable PEP517_SOURCE_PATH to set where the file is.

In the future there should be a pep517.bbclass to centralise the common
logic, but for now this can be defined in each of the relevant classes.

[1] https://www.python.org/dev/peps/pep-0517/

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

Patch

diff --git a/meta/classes/setuptools_build_meta.bbclass b/meta/classes/setuptools_build_meta.bbclass
index 18ae2e6004..787fbd5f36 100644
--- a/meta/classes/setuptools_build_meta.bbclass
+++ b/meta/classes/setuptools_build_meta.bbclass
@@ -2,12 +2,16 @@  inherit pip_install_wheel setuptools3-base
 
 DEPENDS += "python3-setuptools-native python3-wheel-native"
 
+# Where to execute the build process from
+PEP517_SOURCE_PATH ?= "${S}"
+
 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('${PIP_INSTALL_DIST_PATH}')"
 }
 do_compile[cleandirs] += "${PIP_INSTALL_DIST_PATH}"