From 9600cf7b45e14d4afe37d8bab52993c9b93c32c7 Mon Sep 17 00:00:00 2001 From: Scott Dixon Date: Fri, 6 Dec 2024 11:27:59 -0800 Subject: [PATCH] Adding python3.13 to toxic See issue #54 --- README.md | 1 + toxic/Dockerfile | 15 +++++++++++---- toxic/post-provision.sh | 4 ++++ toxic/provision-pip.sh | 27 +++++++++++++++++++++++++++ toxic/provision-python.sh | 24 ++++++++++++++++++++++++ toxic/provision.sh | 27 --------------------------- 6 files changed, 67 insertions(+), 31 deletions(-) create mode 100755 toxic/provision-pip.sh create mode 100755 toxic/provision-python.sh diff --git a/README.md b/README.md index debbed7..c80c1d3 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,7 @@ is based on Ubuntu and provides all modern Python3 distributions, pip, tox, and | tag | Base Python | Python Versions | Tox | Nox | pip | Platforms | Other Utilities | |----------|-------------|-----------------|-----|-----|-----|-----------|-----------------| +| [tx22.4.3](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toxic) | 3.11 | 3.8, 3.9, 3.10, 3.11, 3.12 3.13 | 4.13.0 | 2023.4.22 | 20.0.2 | | | | [tx22.4.2](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toxic) | 3.10 | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 4.13.0 | 2023.4.22 | 20.0.2 | | | | [tx22.4.1](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toxic) | 3.8 | 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 4.4.5 | 2023.4.22 | 20.0.2 | | | | [tx20.4.1](https://github.com/OpenCyphal/docker_toolchains/pkgs/container/toxic) | 3.8 | 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 | 4.4.5 | (not available) | 20.0.2 | | | diff --git a/toxic/Dockerfile b/toxic/Dockerfile index 10af34a..7ea40ce 100644 --- a/toxic/Dockerfile +++ b/toxic/Dockerfile @@ -22,11 +22,21 @@ FROM base AS provisioning WORKDIR /tmp ADD pre-provision.sh ./pre-provision.sh ADD provision.sh ./provision.sh +ADD provision-python.sh ./provision-python.sh +ADD provision-pip.sh ./provision-pip.sh ADD post-provision.sh ./post-provision.sh RUN ./pre-provision.sh RUN ./provision.sh -RUN ./pre-provision.sh +RUN ./provision-python.sh 3.8 6 distutils +RUN ./provision-python.sh 3.9 5 distutils +RUN ./provision-python.sh 3.10 4 distutils +RUN ./provision-python.sh 3.11 3 distutils +RUN ./provision-python.sh 3.12 1 distutils +RUN ./provision-python.sh 3.13 2 +RUN update-alternatives --set python3 /usr/bin/python3.11 +RUN ./provision-pip.sh +RUN ./post-provision.sh @@ -35,8 +45,5 @@ RUN ./pre-provision.sh # +---------------------------------------------------------------------------+ FROM provisioning AS all -# INSTALL THE PATH FOR INTERATIVE SESSIONS -RUN echo "export PATH=$PATH" >> ~/.bashrc - # LEAVE THE WORKDIR AS /repo WORKDIR /repo diff --git a/toxic/post-provision.sh b/toxic/post-provision.sh index 2ceef1b..3b7825c 100755 --- a/toxic/post-provision.sh +++ b/toxic/post-provision.sh @@ -20,7 +20,11 @@ set -o pipefail # +----------------------------------------------------------+ +# INSTALL THE PATH FOR INTERACTIVE SESSIONS +echo "export PATH=$PATH" >> ~/.bashrc + echo "export LANG=en_US.UTF-8" >> ~/.bashrc echo "export LANGUAGE=en_US:en" >> ~/.bashrc echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc + echo "alias la=\"ls -lah\"" >> ~/.bashrc diff --git a/toxic/provision-pip.sh b/toxic/provision-pip.sh new file mode 100755 index 0000000..3b8f000 --- /dev/null +++ b/toxic/provision-pip.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# +----------------------------------------------------------+ +# | BASH : Modifying Shell Behaviour +# | (https://www.gnu.org/software/bash/manual) +# +----------------------------------------------------------+ +# Treat unset variables and parameters other than the special +# parameters ‘@’ or ‘*’ as an error when performing parameter +# expansion. An error message will be written to the standard +# error, and a non-interactive shell will exit. +set -o nounset + +# Exit immediately if a pipeline returns a non-zero status. +set -o errexit + +# If set, the return value of a pipeline is the value of the +# last (rightmost) command to exit with a non-zero status, or +# zero if all commands in the pipeline exit successfully. +set -o pipefail + +# +----------------------------------------------------------+ +export DEBIAN_FRONTEND=noninteractive + +apt-get -y install python3-pip + +pip3 install tox +pip3 install nox diff --git a/toxic/provision-python.sh b/toxic/provision-python.sh new file mode 100755 index 0000000..73fbe98 --- /dev/null +++ b/toxic/provision-python.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# +----------------------------------------------------------+ +# | BASH : Modifying Shell Behaviour +# | (https://www.gnu.org/software/bash/manual) +# +----------------------------------------------------------+ +# Exit immediately if a pipeline returns a non-zero status. +set -o errexit + +# If set, the return value of a pipeline is the value of the +# last (rightmost) command to exit with a non-zero status, or +# zero if all commands in the pipeline exit successfully. +set -o pipefail + +# +----------------------------------------------------------+ +export DEBIAN_FRONTEND=noninteractive + +apt-get -y install python$1 + +if [[ $3 == distutils ]]; then + apt-get -y install python$1-distutils +fi + +update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$1 $2 diff --git a/toxic/provision.sh b/toxic/provision.sh index fbe386d..cce1ca6 100755 --- a/toxic/provision.sh +++ b/toxic/provision.sh @@ -26,30 +26,3 @@ apt-get -y install git apt-get -y install curl apt-get -y install wget apt-get -y install unzip - -# deadsnakes maintains a bunch of python versions for Ubuntu. -add-apt-repository -y ppa:deadsnakes/ppa -apt-get update -apt-get -y install python3.10 -apt-get -y install python3-pip - -apt-get -y install python3.7 -apt-get -y install python3.7-distutils -apt-get -y install python3.8 -apt-get -y install python3.8-distutils -apt-get -y install python3.9 -apt-get -y install python3.9-distutils -apt-get -y install python3.11 -apt-get -y install python3.11-distutils -apt-get -y install python3.12 -apt-get -y install python3.12-distutils - - -pip3 install tox -pip3 install nox - -echo "export PATH=$PATH" >> ~/.bashrc -echo "export LANG=en_US.UTF-8" >> ~/.bashrc -echo "export LANGUAGE=en_US:en" >> ~/.bashrc -echo "export LC_ALL=en_US.UTF-8" >> ~/.bashrc -echo "alias la=\"ls -lah\"" >> ~/.bashrc