aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/build_python.sh
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-10-07 20:27:05 +0100
committerGravatar Chris Lovering <[email protected]>2024-10-07 20:29:52 +0100
commitf7ce899294d259a768d9099a563df378234d3369 (patch)
treee196fca7b9f8dbbf14b16c9e398ffb315a93d17f /scripts/build_python.sh
parentAlso install 3.13t (diff)
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
Diffstat (limited to 'scripts/build_python.sh')
-rwxr-xr-xscripts/build_python.sh14
1 files changed, 11 insertions, 3 deletions
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 \