aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--Dockerfile1
-rwxr-xr-xscripts/build_python.sh14
2 files changed, 11 insertions, 4 deletions
diff --git a/Dockerfile b/Dockerfile
index f68b789..051b275 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -46,7 +46,6 @@ FROM builder-py-base as builder-py-3_13t
# --disable-test-modules --enable-optimizations --with-lto
ENV PYTHON_CONFIGURE_OPTS='--enable-optimizations --with-lto --with-system-expat --without-ensurepip'
RUN /build_python.sh 3.13.0rc3t
-RUN mv /snekbin/python/3.13 /snekbin/python/3.13t
# ------------------------------------------------------------------------------
FROM python:3.12-slim-bookworm as base
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 \