From f7ce899294d259a768d9099a563df378234d3369 Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Mon, 7 Oct 2024 20:27:05 +0100 Subject: Ensure Python versions ending in t are installed to a dir ending in t The t denotes that it is a free threading version of Python, so could potentially be installed along side a non-free-threaded version of Python --- scripts/build_python.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'scripts/build_python.sh') diff --git a/scripts/build_python.sh b/scripts/build_python.sh index 77f50ab..ea3f6d8 100755 --- a/scripts/build_python.sh +++ b/scripts/build_python.sh @@ -4,11 +4,19 @@ shopt -s inherit_errexit py_version="${1}" -# Install Python interpreter under e.g. /snekbin/python/3.11/ (no patch version). +# Install Python interpreter under e.g. /snekbin/python/3.13/ (no patch version) +# By dropping everything after, and including, the last period. +install_path="${1%[-.]*}" + +# If python version ends with a t, then ensure Python is installed to a dir ending with a t. +if [[ $py_version == *t ]]; then + install_path+="t" +fi + "${PYENV_ROOT}/plugins/python-build/bin/python-build" \ "${py_version}" \ - "/snekbin/python/${py_version%[-.]*}" -"/snekbin/python/${py_version%[-.]*}/bin/python" -m pip install -U pip + "/snekbin/python/${install_path}" +"/snekbin/python/${install_path}/bin/python" -m pip install -U pip # Clean up some unnecessary files to reduce image size bloat. find /snekbin/python/ -depth \ -- cgit v1.2.3