From 7a27a256988839811430597615a485c8e2ddb5b5 Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 29 Dec 2025 14:23:44 -0600 Subject: [PATCH 1/2] fix: support free-threaded python3.14t/site-packages prefixes --- cmake/podioBuild.cmake | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/cmake/podioBuild.cmake b/cmake/podioBuild.cmake index e20470b7e..0f434a7e6 100644 --- a/cmake/podioBuild.cmake +++ b/cmake/podioBuild.cmake @@ -214,13 +214,27 @@ endif() # Setup the python install dir. See the discussion in # https://github.com/AIDASoft/podio/pull/599 for more details on why this is # done the way it is +# +# For Python 3.13+ with free-threading (PEP 703), the site-packages directory +# includes a 't' suffix (e.g., python3.14t/site-packages). We use Python's +# own SITEARCH to get the correct path including any ABI suffixes. +# set(podio_python_lib_dir lib) if("${Python3_SITEARCH}" MATCHES "/lib64/") set(podio_python_lib_dir lib64) endif() +# Extract the python-specific part of the path (e.g., python3.14t/site-packages) +# from Python3_SITEARCH +string(REGEX MATCH "python[0-9]+\\.[0-9]+[a-z]*/site-packages" _python_site_subdir "${Python3_SITEARCH}") +if(NOT _python_site_subdir) + # Fallback to manual construction if regex fails + set(_python_site_subdir "python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages") + message(WARNING "Could not extract site-packages path from Python3_SITEARCH (${Python3_SITEARCH}), using fallback: ${_python_site_subdir}") +endif() + set(podio_PYTHON_INSTALLDIR - "${CMAKE_INSTALL_PREFIX}/${podio_python_lib_dir}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + "${CMAKE_INSTALL_PREFIX}/${podio_python_lib_dir}/${_python_site_subdir}" CACHE STRING "The install prefix for the python bindings and the generator and templates" ) From 5415b2920c698d574725b787f3bab1e27d4a084e Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Mon, 29 Dec 2025 14:59:24 -0600 Subject: [PATCH 2/2] fix: append sys.abiflags to e.g. python3.14 in env.sh --- env.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env.sh b/env.sh index 1c0f250a7..34e90d58e 100644 --- a/env.sh +++ b/env.sh @@ -25,7 +25,7 @@ elif [[ "$unamestr" = 'Darwin' ]]; then fi fi -python_stem=python3.$(python -c 'import sys; print(sys.version_info[1])')/site-packages +python_stem=python3.$(python -c 'import sys; print(str(sys.version_info[1]) + sys.abiflags )')/site-packages if [ -d $PODIO/lib64/${python_stem} ]; then if ! echo $PYTHONPATH | grep -o $PODIO/lib64/${python_stem} > /dev/null 2>&1; then export PYTHONPATH=$PODIO/lib64/${python_stem}:$PYTHONPATH