diff options
author | Zoltán Böszörményi <zboszor@gmail.com> | 2023-06-08 14:29:26 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-06-14 09:50:28 -0700 |
commit | 1baf66e09b70e6757c74f5b5ca4f9db396944657 (patch) | |
tree | 4243160f2b50dd918f84b0e9e1de562b69c9ad66 | |
parent | 91e2bfb17fb416e475802f9be9913776ec4e3d4e (diff) | |
download | meta-openembedded-1baf66e09b70e6757c74f5b5ca4f9db396944657.tar.gz |
python_mesonpy: New class
This is a new PEP517 compatible build class for python modules
that use pyproject.toml and this:
[build-system]
build-backend = 'mesonpy'
The new class uses python3-meson-python-native.
Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-python/classes/python_mesonpy.bbclass | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/meta-python/classes/python_mesonpy.bbclass b/meta-python/classes/python_mesonpy.bbclass new file mode 100644 index 000000000..131fa74be --- /dev/null +++ b/meta-python/classes/python_mesonpy.bbclass | |||
@@ -0,0 +1,52 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | inherit 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. | ||
12 | meson_do_qa_configure () { | ||
13 | : | ||
14 | } | ||
15 | |||
16 | # This prevents the meson error: | ||
17 | # ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one. | ||
18 | MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}" | ||
19 | |||
20 | CONFIGURE_FILES = "pyproject.toml" | ||
21 | |||
22 | DEPENDS += "python3-wheel-native python3-meson-python-native" | ||
23 | |||
24 | def 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 | |||
34 | PEP517_BUILD_OPTS = "-Cbuilddir='${B}' ${@mesonpy_get_args(d)}" | ||
35 | |||
36 | # Python pyx -> c -> so build leaves absolute build paths in the code | ||
37 | INSANE_SKIP:${PN} += "buildpaths" | ||
38 | INSANE_SKIP:${PN}-src += "buildpaths" | ||
39 | |||
40 | python_mesonpy_do_configure () { | ||
41 | python_pep517_do_configure | ||
42 | } | ||
43 | |||
44 | python_mesonpy_do_compile () { | ||
45 | python_pep517_do_compile | ||
46 | } | ||
47 | |||
48 | python_mesonpy_do_install () { | ||
49 | python_pep517_do_install | ||
50 | } | ||
51 | |||
52 | EXPORT_FUNCTIONS do_configure do_compile do_install | ||