From: "Zoltán Böszörményi" <zboszor@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: "Alexander Kanavin" <alex.kanavin@gmail.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Zoltán Böszörményi" <zboszor@gmail.com>
Subject: [PATCH v4 3/3] python_mesonpy: New class
Date: Sat, 3 Jun 2023 10:07:03 +0200 [thread overview]
Message-ID: <20230603080703.1400571-3-zboszor@gmail.com> (raw)
In-Reply-To: <20230603080703.1400571-1-zboszor@gmail.com>
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>
---
meta/classes-recipe/python_mesonpy.bbclass | 54 ++++++++++++++++++++++
1 file changed, 54 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..1da8b005ab
--- /dev/null
+++ b/meta/classes-recipe/python_mesonpy.bbclass
@@ -0,0 +1,54 @@
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit meson setuptools3-base python3targetconfig python_pep517
+
+# Filter out meson_do_qa_configure from do_configure[postfuncs]
+DOCONFIGUREPOSTFUNCS := "${@d.getVarFlag('do_configure', 'postfuncs')}"
+DOCONFIGUREPOSTFUNCS:remove = "meson_do_qa_configure"
+do_configure[postfuncs] := "${@'' if d.getVar('DOCONFIGUREPOSTFUNCS') is None else d.getVar('DOCONFIGUREPOSTFUNCS') }"
+
+# 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
+}
+
+python_mesonpy_do_bootstrap_install () {
+ python_pep517_do_bootstrap_install
+}
+
+EXPORT_FUNCTIONS do_configure do_compile do_install
--
2.40.1
next prev parent reply other threads:[~2023-06-03 8:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 8:07 [PATCH v4 1/3] python3-pyproject-metadata: New recipe Zoltán Böszörményi
2023-06-03 8:07 ` [PATCH v4 2/3] python3-meson-python: " Zoltán Böszörményi
2023-06-03 8:07 ` Zoltán Böszörményi [this message]
2023-06-05 11:57 ` [OE-core] [PATCH v4 3/3] python_mesonpy: New class Ross Burton
2023-06-05 12:23 ` Böszörményi Zoltán
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230603080703.1400571-3-zboszor@gmail.com \
--to=zboszor@gmail.com \
--cc=alex.kanavin@gmail.com \
--cc=alexandre.belloni@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).