openembedded-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [meta-python][PATCH 1/2] python3-meson-python: New recipe
@ 2023-06-07  6:55 Zoltán Böszörményi
  2023-06-07  6:55 ` [meta-python][PATCH 2/2] python_mesonpy: New class Zoltán Böszörményi
  0 siblings, 1 reply; 9+ messages in thread
From: Zoltán Böszörményi @ 2023-06-07  6:55 UTC (permalink / raw)
  To: openembedded-devel
  Cc: Tim moto-timo Orling, Derek Straka,
	Zoltán Böszörményi

This python module adds support for a new PEP517 build backend
used by recent versions of scikit-image, scipy and others.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 .../python/python3-meson-python_0.13.1.bb     | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-meson-python_0.13.1.bb

diff --git a/meta-python/recipes-devtools/python/python3-meson-python_0.13.1.bb b/meta-python/recipes-devtools/python/python3-meson-python_0.13.1.bb
new file mode 100644
index 000000000..6b9ff24f2
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-meson-python_0.13.1.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Meson Python build backend (PEP 517)"
+HOMEPAGE = "https://github.com/mesonbuild/meson-python"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d580b27e67cc0892a5b005b0be114b60"
+
+DEPENDS = " \
+	meson-native ninja-native patchelf-native \
+	python3-pyproject-metadata-native \
+"
+
+PYPI_PACKAGE = "meson_python"
+
+inherit pypi python_mesonpy
+SRC_URI[sha256sum] = "63b3170001425c42fa4cfedadb9051cbd28925ff8eed7c40d36ba0099e3c7618"
+
+DEPENDS:remove:class-native = "python3-meson-python-native"
+
+RDEPENDS:${PN} = " \
+	meson ninja patchelf \
+	python3-pyproject-metadata \
+"
+
+BBCLASSEXTEND = "native nativesdk"
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07  6:55 [meta-python][PATCH 1/2] python3-meson-python: New recipe Zoltán Böszörményi
@ 2023-06-07  6:55 ` Zoltán Böszörményi
  2023-06-07  9:57   ` [oe] " Ross Burton
  0 siblings, 1 reply; 9+ messages in thread
From: Zoltán Böszörményi @ 2023-06-07  6:55 UTC (permalink / raw)
  To: openembedded-devel
  Cc: Tim moto-timo Orling, Derek Straka,
	Zoltán Böszörményi

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-python/classes/python_mesonpy.bbclass | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 meta-python/classes/python_mesonpy.bbclass

diff --git a/meta-python/classes/python_mesonpy.bbclass b/meta-python/classes/python_mesonpy.bbclass
new file mode 100644
index 000000000..1da8b005a
--- /dev/null
+++ b/meta-python/classes/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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07  6:55 ` [meta-python][PATCH 2/2] python_mesonpy: New class Zoltán Böszörményi
@ 2023-06-07  9:57   ` Ross Burton
  2023-06-07 11:24     ` Böszörményi Zoltán
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2023-06-07  9:57 UTC (permalink / raw)
  To: zboszor; +Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

On 7 Jun 2023, at 07:55, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
> +# 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') }"

A neater solution would be to just stub out meson_do_qa_configure in this class:

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}"

If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.

> +python_mesonpy_do_bootstrap_install () {
> +    python_pep517_do_bootstrap_install
> +}

This looks redundant and nothing calls it, remove.

Ross

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07  9:57   ` [oe] " Ross Burton
@ 2023-06-07 11:24     ` Böszörményi Zoltán
  2023-06-07 11:26       ` Ross Burton
  0 siblings, 1 reply; 9+ messages in thread
From: Böszörményi Zoltán @ 2023-06-07 11:24 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

2023. 06. 07. 11:57 keltezéssel, Ross Burton írta:
> On 7 Jun 2023, at 07:55, Zoltan Boszormenyi via lists.openembedded.org <zboszor=gmail.com@lists.openembedded.org> wrote:
>> +# 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') }"
> A neater solution would be to just stub out meson_do_qa_configure in this class:
>
> meson_do_qa_configure() { : }

Thanks. I will make this change.

>> +# This prevents the meson error:
>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
> If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.

Why would it break? It does not affect what meson-python is adding internally.

This only removes the setting imposed by meson.bbclass
and only needs to change if meson.bbclass switches to -Dbuildtype.

>> +python_mesonpy_do_bootstrap_install () {
>> +    python_pep517_do_bootstrap_install
>> +}
> This looks redundant and nothing calls it, remove.

Ok.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07 11:24     ` Böszörményi Zoltán
@ 2023-06-07 11:26       ` Ross Burton
  2023-06-07 11:41         ` Böszörményi Zoltán
  0 siblings, 1 reply; 9+ messages in thread
From: Ross Burton @ 2023-06-07 11:26 UTC (permalink / raw)
  To: Böszörményi Zoltán
  Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

On 7 Jun 2023, at 12:24, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>> +# This prevents the meson error:
>>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
>> If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.
> 
> Why would it break? It does not affect what meson-python is adding internally.
> 
> This only removes the setting imposed by meson.bbclass
> and only needs to change if meson.bbclass switches to -Dbuildtype.

My understanding is that meson.bbclass is passing —buildtype and then mesonpy is passing -Dbuildtype.

This :remove removes any —buildtype option, so if mesonpy changes to using —buildtype instead of -Dbuildtype then _both_ buildtype options will be removed, which isn’t what you want.

Ross

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07 11:26       ` Ross Burton
@ 2023-06-07 11:41         ` Böszörményi Zoltán
  2023-06-07 15:35           ` Ross Burton
  0 siblings, 1 reply; 9+ messages in thread
From: Böszörményi Zoltán @ 2023-06-07 11:41 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

2023. 06. 07. 13:26 keltezéssel, Ross Burton írta:
> On 7 Jun 2023, at 12:24, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>>> +# This prevents the meson error:
>>>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>>>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
>>> If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.
>> Why would it break? It does not affect what meson-python is adding internally.
>>
>> This only removes the setting imposed by meson.bbclass
>> and only needs to change if meson.bbclass switches to -Dbuildtype.
> My understanding is that meson.bbclass is passing —buildtype and then mesonpy is passing -Dbuildtype.

Correct.

> This :remove removes any —buildtype option, so if mesonpy changes to using —buildtype instead of -Dbuildtype then _both_ buildtype options will be removed, which isn’t what you want.

Wrong.

This only removes the --buildtype setting from MESONOPTS set by meson.bbclass.
This variable is internal to meson.bbclass, not exported.
It it used this way there:

meson setup ${MESONOPTS} ...

mesonpy doesn't use the MESONOPTS variable to set the buildtype
and since this variable is not exported, meson can't see or use it either.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07 11:41         ` Böszörményi Zoltán
@ 2023-06-07 15:35           ` Ross Burton
  2023-06-08 11:30             ` Böszörményi Zoltán
       [not found]             ` <1766AB9E7F95CBC1.3462@lists.openembedded.org>
  0 siblings, 2 replies; 9+ messages in thread
From: Ross Burton @ 2023-06-07 15:35 UTC (permalink / raw)
  To: Böszörményi Zoltán
  Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

On 7 Jun 2023, at 12:41, Böszörményi Zoltán <zboszor@gmail.com> wrote:
> 
> 2023. 06. 07. 13:26 keltezéssel, Ross Burton írta:
>> On 7 Jun 2023, at 12:24, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>>>> +# This prevents the meson error:
>>>>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>>>>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
>>>> If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.
>>> Why would it break? It does not affect what meson-python is adding internally.
>>> 
>>> This only removes the setting imposed by meson.bbclass
>>> and only needs to change if meson.bbclass switches to -Dbuildtype.
>> My understanding is that meson.bbclass is passing —buildtype and then mesonpy is passing -Dbuildtype.
> 
> Correct.
> 
>> This :remove removes any —buildtype option, so if mesonpy changes to using —buildtype instead of -Dbuildtype then _both_ buildtype options will be removed, which isn’t what you want.
> 
> Wrong.
> 
> This only removes the --buildtype setting from MESONOPTS set by meson.bbclass.

Okay, I take it back, thanks.

Ross

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
  2023-06-07 15:35           ` Ross Burton
@ 2023-06-08 11:30             ` Böszörményi Zoltán
       [not found]             ` <1766AB9E7F95CBC1.3462@lists.openembedded.org>
  1 sibling, 0 replies; 9+ messages in thread
From: Böszörményi Zoltán @ 2023-06-08 11:30 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

2023. 06. 07. 17:35 keltezéssel, Ross Burton írta:
> On 7 Jun 2023, at 12:41, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>> 2023. 06. 07. 13:26 keltezéssel, Ross Burton írta:
>>> On 7 Jun 2023, at 12:24, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>>>>> +# This prevents the meson error:
>>>>>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>>>>>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
>>>>> If mesonpy ever switches to —buildtype then this will break, right?  Might be better to patch mesonpy instead.
>>>> Why would it break? It does not affect what meson-python is adding internally.
>>>>
>>>> This only removes the setting imposed by meson.bbclass
>>>> and only needs to change if meson.bbclass switches to -Dbuildtype.
>>> My understanding is that meson.bbclass is passing —buildtype and then mesonpy is passing -Dbuildtype.
>> Correct.
>>
>>> This :remove removes any —buildtype option, so if mesonpy changes to using —buildtype instead of -Dbuildtype then _both_ buildtype options will be removed, which isn’t what you want.
>> Wrong.
>>
>> This only removes the --buildtype setting from MESONOPTS set by meson.bbclass.
> Okay, I take it back, thanks.

Thanks. I will send the updated series shortly.

As a side note, do you know why -I/usr/include/python3.11 may get added
to the build command by meson? It happens on a Fedora 38 build host
but it doesn't happen on a Fedora 33 build host. As a result, building
my in-house python3-scikit-image recipe fails on Fedora 38.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [oe] [meta-python][PATCH 2/2] python_mesonpy: New class
       [not found]             ` <1766AB9E7F95CBC1.3462@lists.openembedded.org>
@ 2023-06-08 11:43               ` Böszörményi Zoltán
  0 siblings, 0 replies; 9+ messages in thread
From: Böszörményi Zoltán @ 2023-06-08 11:43 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-devel, Tim moto-timo Orling, Derek Straka

2023. 06. 08. 13:30 keltezéssel, Zoltan Boszormenyi via lists.openembedded.org írta:
> 2023. 06. 07. 17:35 keltezéssel, Ross Burton írta:
>> On 7 Jun 2023, at 12:41, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>> 2023. 06. 07. 13:26 keltezéssel, Ross Burton írta:
>>>> On 7 Jun 2023, at 12:24, Böszörményi Zoltán <zboszor@gmail.com> wrote:
>>>>>>> +# This prevents the meson error:
>>>>>>> +# ERROR: Got argument buildtype as both -Dbuildtype and --buildtype. Pick one.
>>>>>>> +MESONOPTS:remove = "--buildtype ${MESON_BUILDTYPE}"
>>>>>> If mesonpy ever switches to —buildtype then this will break, right?  Might be 
>>>>>> better to patch mesonpy instead.
>>>>> Why would it break? It does not affect what meson-python is adding internally.
>>>>>
>>>>> This only removes the setting imposed by meson.bbclass
>>>>> and only needs to change if meson.bbclass switches to -Dbuildtype.
>>>> My understanding is that meson.bbclass is passing —buildtype and then mesonpy is 
>>>> passing -Dbuildtype.
>>> Correct.
>>>
>>>> This :remove removes any —buildtype option, so if mesonpy changes to using —buildtype 
>>>> instead of -Dbuildtype then _both_ buildtype options will be removed, which isn’t 
>>>> what you want.
>>> Wrong.
>>>
>>> This only removes the --buildtype setting from MESONOPTS set by meson.bbclass.
>> Okay, I take it back, thanks.
>
> Thanks. I will send the updated series shortly.
>
> As a side note, do you know why -I/usr/include/python3.11 may get added
> to the build command by meson? It happens on a Fedora 38 build host
> but it doesn't happen on a Fedora 33 build host. As a result, building
> my in-house python3-scikit-image recipe fails on Fedora 38.

Nevermind, it's fixed by adding "inherit pkgconfig" to the recipe.

>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#103186): https://lists.openembedded.org/g/openembedded-devel/message/103186
> Mute This Topic: https://lists.openembedded.org/mt/99379800/3617728
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [zboszor@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-06-08 11:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07  6:55 [meta-python][PATCH 1/2] python3-meson-python: New recipe Zoltán Böszörményi
2023-06-07  6:55 ` [meta-python][PATCH 2/2] python_mesonpy: New class Zoltán Böszörményi
2023-06-07  9:57   ` [oe] " Ross Burton
2023-06-07 11:24     ` Böszörményi Zoltán
2023-06-07 11:26       ` Ross Burton
2023-06-07 11:41         ` Böszörményi Zoltán
2023-06-07 15:35           ` Ross Burton
2023-06-08 11:30             ` Böszörményi Zoltán
     [not found]             ` <1766AB9E7F95CBC1.3462@lists.openembedded.org>
2023-06-08 11:43               ` Böszörményi Zoltán

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).