From 10e59b23e31ed279e960173b3eabf04bb4aeffe3 Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Tue, 15 Oct 2024 12:50:05 +0200 Subject: [PATCH 1/3] Rebuild python dependencies whenever needed --- python-modules.sh | 2 +- python.sh | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/python-modules.sh b/python-modules.sh index 371bb6c7b1..e186fd0951 100644 --- a/python-modules.sh +++ b/python-modules.sh @@ -1,7 +1,7 @@ package: Python-modules version: "1.0" requires: - - "Python:(slc|ubuntu)" + - "Python" - "Python-system:(?!slc.*|ubuntu)" - "FreeType:(?!osx)" - libpng diff --git a/python.sh b/python.sh index 6650da6440..ccbe1754c0 100644 --- a/python.sh +++ b/python.sh @@ -17,8 +17,20 @@ env: PYTHONHOME: "$PYTHON_ROOT" PYTHONPATH: "$PYTHON_ROOT/lib/python/site-packages" prefer_system: "(?!slc5|ubuntu)" -prefer_system_check: - python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) 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_check: | + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' + python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) or sys.version_info > (3, 13) 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: + "python3.9": + version: "3.9" + "python3.10": + version: "3.10" + "python3.11": + version: "3.11" + "python3.12": + version: "3.12" + "python3.13": + version: "3.13" --- rsync -av --exclude '**/.git' $SOURCEDIR/ $BUILDDIR/ From dd98d845132f2c49e0ff0749641ccae768ae5a75 Mon Sep 17 00:00:00 2001 From: Sergio Date: Tue, 5 Nov 2024 10:54:08 +0100 Subject: [PATCH 2/3] Improve system detection for brew python --- python.sh | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/python.sh b/python.sh index ccbe1754c0..67c448b288 100644 --- a/python.sh +++ b/python.sh @@ -18,19 +18,23 @@ env: PYTHONPATH: "$PYTHON_ROOT/lib/python/site-packages" prefer_system: "(?!slc5|ubuntu)" prefer_system_check: | - python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' - python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) or sys.version_info > (3, 13) 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 + 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}")' ;; + *) + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' + ;; + esac + python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) or sys.version_info > (3, 13) 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: - "python3.9": - version: "3.9" - "python3.10": - version: "3.10" - "python3.11": - version: "3.11" - "python3.12": - version: "3.12" - "python3.13": - version: "3.13" + "python-brew3.*": + env: + PYTHON_ROOT: $(brew --prefix python3) + PYTHON_REVISION: "" + "python3.*": + env: + PYTHON_ROOT: "" + PYTHON_REVISION: "" --- rsync -av --exclude '**/.git' $SOURCEDIR/ $BUILDDIR/ From f82c06050ddf1c0a1e3a55eed017af114b233139 Mon Sep 17 00:00:00 2001 From: Sergio Date: Wed, 13 Nov 2024 17:01:44 +0100 Subject: [PATCH 3/3] Add workaround for old alibuild versions (< v1.17.12) --- python.sh | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/python.sh b/python.sh index 67c448b288..5a31a43960 100644 --- a/python.sh +++ b/python.sh @@ -18,13 +18,27 @@ env: PYTHONPATH: "$PYTHON_ROOT/lib/python/site-packages" prefer_system: "(?!slc5|ubuntu)" prefer_system_check: | - 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}")' ;; - *) - python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' - ;; - esac + MIN_ALIBUILD_VERSION_REGEX="v1.17.12" + if [[ $(printf '%s\n' "$ALIBUILD_VERSION" "$MIN_ALIBUILD_VERSION_REGEX" | sort -V | head -n 1) == "$ALIBUILD_VERSION" && "$ALIBUILD_VERSION" != "$MIN_ALIBUILD_VERSION_REGEX" ]]; then + # Workaround to support old alibuild versions that don't regex match alibuild_system_replace + case $ALIBUILD_ARCHITECTURE in + osx*) + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python-brew3")' ;; + *) + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python3")' + ;; + esac + 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}")' ;; + *) + python3 -c 'from sys import version_info; print(f"alibuild_system_replace: python{version_info.major}.{version_info.minor}")' + ;; + esac + fi + + python3 -c 'import sys; import sqlite3; sys.exit(1 if sys.version_info < (3, 9) or sys.version_info > (3, 13) 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.*": @@ -35,6 +49,16 @@ prefer_system_replacement_specs: env: PYTHON_ROOT: "" PYTHON_REVISION: "" + + # Workaround to support old alibuild versions that don't regex match alibuild_system_replace + "python-brew3": + env: + PYTHON_ROOT: $(brew --prefix python3) + PYTHON_REVISION: "" + "python3": + env: + PYTHON_ROOT: "" + PYTHON_REVISION: "" --- rsync -av --exclude '**/.git' $SOURCEDIR/ $BUILDDIR/