setuptools3_legacy: add pyproject.toml check

Copy the pyproject.toml check from setuptools3.bbclass so that the legacy
class will also warn if there's a modern build framework available.

(From OE-Core rev: f524589f3d35475600954f5b27b4b74ea079e13c)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton
2025-07-29 09:59:31 +01:00
committed by Richard Purdie
parent f15ee6b099
commit 4c2e3f1a59

View File

@@ -30,6 +30,20 @@ SETUPTOOLS_PYTHON:class-native = "nativepython3"
SETUPTOOLS_SETUP_PATH ?= "${S}"
python do_check_backend() {
import re
filename = d.expand("${SETUPTOOLS_SETUP_PATH}/pyproject.toml")
if os.path.exists(filename):
for line in open(filename):
match = re.match(r"build-backend\s*=\s*\W([\w.]+)\W", line)
if not match: continue
msg = f"inherits setuptools3_legacy but has pyproject.toml with {match[1]}, use the correct class"
if "pep517-backend" not in (d.getVar("INSANE_SKIP") or "").split():
oe.qa.handle_error("pep517-backend", msg, d)
}
addtask check_backend after do_patch before do_configure
setuptools3_legacy_do_configure() {
:
}