summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Orling <ticotimo@gmail.com>2024-02-19 09:30:22 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-20 11:39:45 +0000
commita7484a66b42b8b0eaf3336272827f0bd10668685 (patch)
treeb7480a6f67599bf9c823ee8877ed60d5e0946358
parentc0a2e3a9664f8755695704593ed3ea4ab5c09340 (diff)
downloadpoky-a7484a66b42b8b0eaf3336272827f0bd10668685.tar.gz
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 <tim.orling@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes-recipe/python_mesonpy.bbclass52
1 files changed, 52 insertions, 0 deletions
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 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7inherit meson setuptools3-base python3targetconfig python_pep517
8
9# meson_do_qa_configure does the wrong thing here because
10# mesonpy runs "meson setup ..." in do_compile context.
11# Make it a dummy function.
12meson_do_qa_configure () {
13 :
14}
15
16# This prevents the meson error:
17# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
18MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
19
20CONFIGURE_FILES = "pyproject.toml"
21
22DEPENDS += "python3-wheel-native python3-meson-python-native"
23
24def mesonpy_get_args(d):
25 vars = ['MESONOPTS', 'MESON_CROSS_FILE', 'EXTRA_OEMESON']
26 varlist = []
27 for var in vars:
28 value = d.getVar(var)
29 vallist = value.split()
30 for elem in vallist:
31 varlist.append("-Csetup-args=" + elem)
32 return ' '.join(varlist)
33
34PEP517_BUILD_OPTS = "-Cbuilddir='${B}' ${@mesonpy_get_args(d)}"
35
36# Python pyx -> c -> so build leaves absolute build paths in the code
37INSANE_SKIP:${PN} += "buildpaths"
38INSANE_SKIP:${PN}-src += "buildpaths"
39
40python_mesonpy_do_configure () {
41 python_pep517_do_configure
42}
43
44python_mesonpy_do_compile () {
45 python_pep517_do_compile
46}
47
48python_mesonpy_do_install () {
49 python_pep517_do_install
50}
51
52EXPORT_FUNCTIONS do_configure do_compile do_install