From: Ionen Wolkens <ionen@gentoo.org>
To: gentoo-dev@lists.gentoo.org, base-system@gentoo.org
Subject: Re: [gentoo-dev] [PATCH] meson.eclass: setup python binaries if python eclasses are used
Date: Thu, 22 May 2025 01:56:53 -0400 [thread overview]
Message-ID: <aC68peGYcb_Wk3dj@eversor> (raw)
In-Reply-To: <aC6xN0rXzKSBDjfW@eversor>
[-- Attachment #1: Type: text/plain, Size: 2542 bytes --]
On Thu, May 22, 2025 at 01:08:07AM -0400, Ionen Wolkens wrote:
> On Thu, May 22, 2025 at 12:35:48AM -0400, Eli Schwartz wrote:
> > This has been bothering me for a while. Meson will detect
> > find_program('python3') as the dummy shim in ${T} defined by the eclass,
> > and py.find_installation() may be the python that *Meson* was built
> > with. In DISTUTILS_USE_PEP517=meson-python a dedicated machine file is
> > created by the build backend but we should set this for other types of
> > packages as well.
> >
> > Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
> > ---
> > eclass/meson.eclass | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/eclass/meson.eclass b/eclass/meson.eclass
> > index a2bc5537e458..ab82234942d5 100644
> > --- a/eclass/meson.eclass
> > +++ b/eclass/meson.eclass
> > @@ -1,4 +1,4 @@
> > -# Copyright 2017-2024 Gentoo Authors
> > +# Copyright 2017-2025 Gentoo Authors
> > # Distributed under the terms of the GNU General Public License v2
> >
> > # @ECLASS: meson.eclass
> > @@ -224,7 +224,16 @@ _meson_create_native_file() {
> > pkg-config = '$(tc-getBUILD_PKG_CONFIG)'
> > strip = $(_meson_env_array "$(tc-getBUILD_STRIP)")
> > windres = $(_meson_env_array "$(tc-getBUILD_PROG RC windres)")
> > + EOF
> > +
> > + if [[ -n ${EPYTHON} ]]; then
> > + cat >> "${fn}" <<-EOF
> > + python = '${EPREFIX}/usr/bin/${EPYTHON}'
> > + python3 = '${EPREFIX}/usr/bin/${EPYTHON}'
> > + EOF
> > + fi
>
> One problem is that there is two potential usecase here.
>
> 1. build system storing path for runtime use (rare'ish)
> 2. using at build time for some script (more common)
>
> 1 should indeed be ${EPREFIX}/usr/bin/${EPYTHON}
> 2 should be either the wrapper or ${PYTHON} which includes BROOT
To add to this, guess we "could" use ${PYTHON} here as it'll be right
when ROOT is unset and not break build-time usage for crossdev, but
feel that just makes wrong-runtime-path issues harder to notice (vs
the ${T} one) given we'll only spot issues with ROOT.
tl;dr think the current situation is better even if means needing
ebuild workarounds for #1.
>
> So I think this breaks ROOT builds unless I'm missing something.
>
> >
> > + cat >> "${fn}" <<-EOF
> > [built-in options]
> > c_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_CPPFLAGS}")
> > c_link_args = $(_meson_env_array "${BUILD_CFLAGS} ${BUILD_LDFLAGS}")
> > --
> > 2.49.0
> >
> >
>
> --
> ionen
--
ionen
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-05-22 5:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 4:35 [gentoo-dev] [PATCH] meson.eclass: setup python binaries if python eclasses are used Eli Schwartz
2025-05-22 5:08 ` Ionen Wolkens
2025-05-22 5:56 ` Ionen Wolkens [this message]
2025-05-22 20:43 ` James Le Cuirot
-- strict thread matches above, loose matches on Subject: below --
2025-05-22 4:29 Eli Schwartz
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=aC68peGYcb_Wk3dj@eversor \
--to=ionen@gentoo.org \
--cc=base-system@gentoo.org \
--cc=gentoo-dev@lists.gentoo.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