diff mbox series

[RFC,4/4] python3, python3-dir.bbclass: Support Python free-threading

Message ID 20260326150225.2083962-5-zboszor@gmail.com
State New
Headers show
Series Enable Python free-threading | expand

Commit Message

Zoltán Böszörményi March 26, 2026, 2:35 p.m. UTC
A new DISTRO_FEATURE[_NATIVE] = "python_freethreading" sets
PYTHON_ABI[_NATIVE]. This enables PACKAGECONFIG[freethreading] for
python3 and allows building Python modules.

Also added PYTHON_MAINVERSION_NATIVE and PYTHON_DIR_NATIVE in
an anticipation that they may be different.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
 meta/classes-recipe/python3-dir.bbclass        | 5 ++++-
 meta/recipes-devtools/python/python3_3.14.3.bb | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/python3-dir.bbclass b/meta/classes-recipe/python3-dir.bbclass
index f3ad0a2d91..748ef3ec6e 100644
--- a/meta/classes-recipe/python3-dir.bbclass
+++ b/meta/classes-recipe/python3-dir.bbclass
@@ -5,8 +5,11 @@ 
 #
 
 PYTHON_BASEVERSION = "3.14"
-PYTHON_ABI = ""
+PYTHON_ABI = "${@bb.utils.contains('DISTRO_FEATURES', 'python_freethreading', 't', '', d)}"
+PYTHON_ABI_NATIVE = "${@bb.utils.contains('DISTRO_FEATURES_NATIVE', 'python_freethreading', 't', '', d)}"
 PYTHON_MAINVERSION = "${PYTHON_BASEVERSION}${PYTHON_ABI}"
+PYTHON_MAINVERSION_NATIVE = "${PYTHON_BASEVERSION}${PYTHON_ABI_NATIVE}"
 PYTHON_DIR = "python${PYTHON_MAINVERSION}"
+PYTHON_DIR_NATIVE = "python${PYTHON_MAINVERSION_NATIVE}"
 PYTHON_PN = "python3"
 PYTHON_SITEPACKAGES_DIR = "${libdir}/${PYTHON_DIR}/site-packages"
diff --git a/meta/recipes-devtools/python/python3_3.14.3.bb b/meta/recipes-devtools/python/python3_3.14.3.bb
index 12d1223d4c..f62ed5f0e2 100644
--- a/meta/recipes-devtools/python/python3_3.14.3.bb
+++ b/meta/recipes-devtools/python/python3_3.14.3.bb
@@ -109,7 +109,11 @@  CACHED_CONFIGUREVARS:append:libc-musl = "\
 "
 
 # PGO currently causes builds to not be reproducible so disable by default, see YOCTO #13407
-PACKAGECONFIG ??= "editline gdbm ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)}"
+# For freethreading, see the comment below.
+PACKAGECONFIG ??= "editline gdbm \
+    ${@bb.utils.filter('DISTRO_FEATURES', 'lto', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'python_freethreading', 'freethreading', '', d)} \
+"
 
 # Some LLVM/CLANG subprojects (e.g. lldb) and many Python modules
 # do not build when free-threading is enabled. Also, the support