Mailing List Archive

[PATCH v2 4/5] distutils-r1.eclass: wire up meson-python to meson.eclass
The meson-python build backend -- as the name suggests -- uses meson
under the hood. We have a meson eclass which does lots of useful things
pertinent to meson. Make sure it gets invoked, by prying out the options
that meson_src_configure would use and setting passing them as our seed
values for gpep517.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
---

v2: call setup_meson_src_configure instead of meson_src_configure. This
avoids running `meson setup` twice, and guarantees we use whatever
settings the PEP517 backend requires. In particular, it respects numpy's
vendored meson fork with experimental new features.

eclass/distutils-r1.eclass | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index c0d1992ccce0..a42adc182ed9 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -197,6 +197,10 @@ _DISTUTILS_R1_ECLASS=1
inherit flag-o-matic
inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs

+if [[ ${DISTUTILS_USE_PEP517} = meson-python ]]; then
+ inherit meson
+fi
+
if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
inherit python-r1
else
@@ -1386,9 +1390,11 @@ distutils_pep517_install() {
)
;;
meson-python)
+ local mesonargs=()
+ setup_meson_src_configure "${DISTUTILS_ARGS[@]}"
local -x NINJAOPTS=$(get_NINJAOPTS)
config_settings=$(
- "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
+ "${EPYTHON}" - "${mesonargs[@]}" <<-EOF || die
import json
import os
import shlex
--
2.43.0
Re: [PATCH v2 4/5] distutils-r1.eclass: wire up meson-python to meson.eclass [ In reply to ]
On Tue, 2024-02-20 at 01:14 -0500, Eli Schwartz wrote:
> The meson-python build backend -- as the name suggests -- uses meson
> under the hood. We have a meson eclass which does lots of useful things
> pertinent to meson. Make sure it gets invoked, by prying out the options
> that meson_src_configure would use and setting passing them as our seed
> values for gpep517.
>
> Signed-off-by: Eli Schwartz <eschwartz93@gmail.com>
> ---
>
> v2: call setup_meson_src_configure instead of meson_src_configure. This
> avoids running `meson setup` twice, and guarantees we use whatever
> settings the PEP517 backend requires. In particular, it respects numpy's
> vendored meson fork with experimental new features.
>
> eclass/distutils-r1.eclass | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
> index c0d1992ccce0..a42adc182ed9 100644
> --- a/eclass/distutils-r1.eclass
> +++ b/eclass/distutils-r1.eclass
> @@ -197,6 +197,10 @@ _DISTUTILS_R1_ECLASS=1
> inherit flag-o-matic
> inherit multibuild multilib multiprocessing ninja-utils toolchain-funcs
>
> +if [[ ${DISTUTILS_USE_PEP517} = meson-python ]]; then

We use '==' throughout.

> + inherit meson
> +fi
> +
> if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
> inherit python-r1
> else
> @@ -1386,9 +1390,11 @@ distutils_pep517_install() {
> )
> ;;
> meson-python)
> + local mesonargs=()
> + setup_meson_src_configure "${DISTUTILS_ARGS[@]}"
> local -x NINJAOPTS=$(get_NINJAOPTS)
> config_settings=$(
> - "${EPYTHON}" - "${DISTUTILS_ARGS[@]}" <<-EOF || die
> + "${EPYTHON}" - "${mesonargs[@]}" <<-EOF || die
> import json
> import os
> import shlex

--
Best regards,
Micha? Górny
Re: [PATCH v2 4/5] distutils-r1.eclass: wire up meson-python to meson.eclass [ In reply to ]
On 2/20/24 1:55 AM, Micha? Górny wrote:
>> +if [[ ${DISTUTILS_USE_PEP517} = meson-python ]]; then
>
> We use '==' throughout.


I'm sorry to hear that. Would you like a patch to remove it everywhere
else? :)

Shell is a complex language to get consistently right already. The
double equals is almost-offensively redundant and pointless -- its
implementation is to be an exact alias for a single equals.

It causes muscle memory to be more likely to accidentally use this
bashism in #!/bin/sh scripts, it provides zero benefit, and the cherry
on top is that it takes up possibly-valuable real estate from your
screen width and causes (uncompressed) scripts to be (trivially) larger.

I wish Chet would repent of having added it and make bash issue a
bash-level warning on stderr if it encounters one in your scripts.


--
Eli Schwartz