• [gentoo-dev] [PATCH] meson.eclass: setup python binaries if python ecla

    From Eli Schwartz@21:1/5 to All on Thu May 22 06:40:01 2025
    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
    package 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

    + 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.4