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
+ 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
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
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
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
+ 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}")
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (2 / 14) |
Uptime: | 00:45:47 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,571 |