From a7484a66b42b8b0eaf3336272827f0bd10668685 Mon Sep 17 00:00:00 2001 From: Tim Orling Date: Mon, 19 Feb 2024 09:30:22 -0800 Subject: python_mesonpy.bbclass: move from meta-python Move the PEP-517 back-end bbclass from meta-python to support: [build-system] build-backend = "mesonpy" This is the declared backend in python3-numpy since: https://github.com/numpy/numpy/commit/942fb8caf33a65e449fbf198ecf1cd39be953248 (From OE-Core rev: f0d3478913b092a01eceafe0c20378cf9117f429) Signed-off-by: Tim Orling Signed-off-by: Richard Purdie --- meta/classes-recipe/python_mesonpy.bbclass | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 meta/classes-recipe/python_mesonpy.bbclass diff --git a/meta/classes-recipe/python_mesonpy.bbclass b/meta/classes-recipe/python_mesonpy.bbclass new file mode 100644 index 0000000000..131fa74bed --- /dev/null +++ b/meta/classes-recipe/python_mesonpy.bbclass @@ -0,0 +1,52 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +inherit meson setuptools3-base python3targetconfig python_pep517 + +# meson_do_qa_configure does the wrong thing here because +# mesonpy runs "meson setup ..." in do_compile context. +# Make it a dummy function. +meson_do_qa_configure () { + : +} + +# This prevents the meson error: +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one. +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}" + +CONFIGURE_FILES = "pyproject.toml" + +DEPENDS += "python3-wheel-native python3-meson-python-native" + +def mesonpy_get_args(d): + vars = ['MESONOPTS', 'MESON_CROSS_FILE', 'EXTRA_OEMESON'] + varlist = [] + for var in vars: + value = d.getVar(var) + vallist = value.split() + for elem in vallist: + varlist.append("-Csetup-args=" + elem) + return ' '.join(varlist) + +PEP517_BUILD_OPTS = "-Cbuilddir='${B}' ${@mesonpy_get_args(d)}" + +# Python pyx -> c -> so build leaves absolute build paths in the code +INSANE_SKIP:${PN} += "buildpaths" +INSANE_SKIP:${PN}-src += "buildpaths" + +python_mesonpy_do_configure () { + python_pep517_do_configure +} + +python_mesonpy_do_compile () { + python_pep517_do_compile +} + +python_mesonpy_do_install () { + python_pep517_do_install +} + +EXPORT_FUNCTIONS do_configure do_compile do_install -- cgit v1.2.3-54-g00ecf