summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2024-07-25 16:30:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-07-26 12:28:42 +0100
commit6e409b5d1917f216aff4eec36cd90a77a1089c9b (patch)
treeda7107e7f0c64617fd09a60e31cbb85c23fdfd0e /meta
parente78e0cc8225236f8d84ecbc577b55fba23541880 (diff)
downloadpoky-6e409b5d1917f216aff4eec36cd90a77a1089c9b.tar.gz
setuptools3: check for a PEP517 build system selection
Some recipes use setuptools3 but should be using a PEP517-compliant backend, be it the setuptools itself via python_setuptools_build_meta or an alternative backend such as flit/hatch/poetry. As we can't currently assume Python 3.11 on the build host we need to parse the pyproject.toml manually, but this should be sufficient for the limited parsing needed. This task emits a QA error if a build backend is set, and can be ignored by using INSANE_SKIP if needed. [ YOCTO #14736 ] (From OE-Core rev: a9d800f6cdfcedbe3de8366d935ee5f0c8557c06) Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes-recipe/setuptools3.bbclass14
1 files changed, 14 insertions, 0 deletions
diff --git a/meta/classes-recipe/setuptools3.bbclass b/meta/classes-recipe/setuptools3.bbclass
index d71a089539..64a78e9a36 100644
--- a/meta/classes-recipe/setuptools3.bbclass
+++ b/meta/classes-recipe/setuptools3.bbclass
@@ -12,6 +12,20 @@ SETUPTOOLS_BUILD_ARGS ?= ""
12 12
13SETUPTOOLS_SETUP_PATH ?= "${S}" 13SETUPTOOLS_SETUP_PATH ?= "${S}"
14 14
15python do_check_backend() {
16 import re
17 filename = d.expand("${SETUPTOOLS_SETUP_PATH}/pyproject.toml")
18 if os.path.exists(filename):
19 for line in open(filename):
20 match = re.match(r"build-backend\s*=\s*\W([\w.]+)\W", line)
21 if not match: continue
22
23 msg = f"inherits setuptools3 but has pyproject.toml with {match[1]}, use the correct class"
24 if "pep517-backend" not in (d.getVar("INSANE_SKIP") or "").split():
25 oe.qa.handle_error("pep517-backend", msg, d)
26}
27addtask check_backend after do_patch before do_configure
28
15setuptools3_do_configure() { 29setuptools3_do_configure() {
16 : 30 :
17} 31}