[PATCH v3 05/12] python_pyo3.bbclass: Pass ABI flag and use PYTHON_MAINVERSION

Zoltán Böszörményi
2026-03-27T08:31:21Z

Setting the ABI flag correctly is necessary for modules using
python_maturin.bbclass and others based on pyo3.

Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com>
---
meta/classes-recipe/python_pyo3.bbclass | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/python_pyo3.bbclass b/meta/classes-recipe/python_pyo3.bbclass
index 7f5a00f584..c618d711ac 100644
--- a/meta/classes-recipe/python_pyo3.bbclass
+++ b/meta/classes-recipe/python_pyo3.bbclass
@@ -12,7 +12,8 @@
inherit cargo python3-dir siteinfo

export PYO3_CROSS = "1"
-export PYO3_CROSS_PYTHON_VERSION = "${PYTHON_BASEVERSION}"
+export PYO3_CROSS_PYTHON_VERSION = "${PYTHON_MAINVERSION}"
+export ABIFLAGS = "${PYTHON_ABI}"
export PYO3_CROSS_LIB_DIR = "${STAGING_LIBDIR}"
export CARGO_BUILD_TARGET = "${RUST_HOST_SYS}"
export RUSTFLAGS
@@ -25,6 +26,7 @@ implementation=CPython
version=${PYTHON_BASEVERSION}
shared=true
abi3=false
+abiflags=${PYTHON_ABI}
lib_name=${PYTHON_DIR}
lib_dir=${STAGING_LIBDIR}
pointer_width=${SITEINFO_BITS}
--
2.53.0