From 8bf838bd1a65037df6811c14e460b27c5ae83633 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 18 Mar 2025 14:48:30 +0100 Subject: [PATCH] Force python rebuilds when patch level changes This is needed because homebrew now has the full version in the path to the various python executables which can then be cached by CMake. --- python.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python.sh b/python.sh index 27bd9c3660..67f1115dfc 100644 --- a/python.sh +++ b/python.sh @@ -31,7 +31,8 @@ prefer_system_check: | else case $ALIBUILD_ARCHITECTURE in osx*) - python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python-brew{version_info.major}.{version_info.minor}")' ;; + # We need to include the python patch number because brew has it in the path + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python-brew{version_info.major}.{version_info.minor}.{version_info.micro}")' ;; *) python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' ;; @@ -42,10 +43,12 @@ prefer_system_check: | python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) or sys.version_info > (3, 14) else 0)' && python3 -m pip --help > /dev/null && printf '#include "pyconfig.h"' | cc -c $(python3-config --includes) -xc -o /dev/null -; if [ $? -ne 0 ]; then printf "Python, the Python development packages, and pip must be installed on your system.\nUsually those packages are called python, python-devel (or python-dev) and python-pip.\n"; exit 1; fi prefer_system_replacement_specs: "python-brew3.*": + version: "%(key)s" env: PYTHON_ROOT: $(brew --prefix python3) PYTHON_REVISION: "" "python3.*": + version: "%(key)s" env: # Python is in path, so we need a dummy placeholder for PYTHON_ROOT # to avoid having /bin in the middle of the path. @@ -54,10 +57,12 @@ prefer_system_replacement_specs: # Workaround to support old alibuild versions that don't regex match alibuild_system_replace "python-brew3": + version: "%(key)s" env: PYTHON_ROOT: $(brew --prefix python3) PYTHON_REVISION: "" "python3": + version: "%(key)s" env: # Python is in path, so we need a dummy placeholder for PYTHON_ROOT # to avoid having /bin in the middle of the path.