From 4a5f7213298b343b0b2cb1f9b855862e77b46c2e Mon Sep 17 00:00:00 2001 From: puqeko Date: Fri, 18 Jul 2025 23:59:59 +1200 Subject: [PATCH 1/2] Update Python to 3.14 pre-release --- db/languages.yml | 5 ++++- script/install/debootstrap.bash | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/db/languages.yml b/db/languages.yml index 1b4765b8d..c5555c366 100644 --- a/db/languages.yml +++ b/db/languages.yml @@ -97,7 +97,7 @@ python: lexer: python compiled: no interpreted: yes - current: python3.8 + current: python3.14 extension: .py source_filename: program processes: 1 @@ -113,6 +113,9 @@ python: python3.8: name: "Python 3.8" interpreter: /usr/bin/python3.8 + python3.14: + name: "Python 3.14" + interpreter: /usr/bin/python3.14 pypy3: name: "Python 3.6 (PyPy 7.3)" interpreter: /usr/bin/pypy3 diff --git a/script/install/debootstrap.bash b/script/install/debootstrap.bash index 4fa725a3c..aa060fb1c 100644 --- a/script/install/debootstrap.bash +++ b/script/install/debootstrap.bash @@ -138,6 +138,37 @@ chroot "$ISOLATE_ROOT" apt-get install ruby # Ruby (ruby) chroot "$ISOLATE_ROOT" apt-get install python3.8 # Python 3.8 # note: when updating these Python versions, also update the check for adding the PPA above + # Compile Python 3.14-prerelease from source + echo "Downloading Python 3.14.0b4 source" + wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0b4.tgz + echo "Extracting Python 3.14.0b4" + tar -xzf Python-3.14.0b4.tgz + rm Python-3.14.0b4.tgz + + echo "Configuring Python 3.14 build" + cd Python-3.14.0b4 + ./configure --enable-optimizations --prefix=$(pwd)/build + + echo "Building Python 3.14" + make -j$(nproc) + + echo "Installing Python 3.14 to build directory" + make install + + echo "Creating target directory in chroot" + mkdir -p "$ISOLATE_ROOT/opt/python/3.14" + + echo "Copying Python 3.14 build to chroot" + cp -r build/* "$ISOLATE_ROOT/opt/python/3.14/" + + echo "Creating symlink in chroot" + chroot "$ISOLATE_ROOT" ln -sf /opt/python/3.14/bin/python3.14 /usr/bin/python3.14 + + echo "Cleaning up Python 3.14 build directory" + cd .. + rm -rf Python-3.14.0b4 + + # PyPy # https://www.pypy.org echo "$chroot_install pypy3" From 28b68cd0712c9de6af223fb82197a03aded1ec3a Mon Sep 17 00:00:00 2001 From: puqeko Date: Sat, 19 Jul 2025 00:36:13 +1200 Subject: [PATCH 2/2] Add PyPy 3.11 --- app/models/language.rb | 2 +- db/languages.yml | 3 +++ script/install/debootstrap.bash | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/models/language.rb b/app/models/language.rb index f2ccd4a61..d854bf41f 100644 --- a/app/models/language.rb +++ b/app/models/language.rb @@ -59,7 +59,7 @@ def self.submission_options # for the selection dropdown def self.grouped_submission_options current = ["c++", "c", "python", "csharp", "java", "javascript", "haskell", "ruby", "j"] # language group identifiers, order is preserved - other = ["c++14", "c99", "pypy3"] # language identifiers, ordered by language name + other = ["c++14", "c99", "pypy3.11"] # language identifiers, ordered by language name current_langs = LanguageGroup.where(identifier: current).preload(:current_language).map(&:current_language) current_options = current_langs.sort_by { |lang| current.index(lang.group.identifier) }.map { |lang| [lang.name, lang.id] } other_options = Language.where(identifier: other).order(:name).pluck(:name, :id) diff --git a/db/languages.yml b/db/languages.yml index c5555c366..80f6f1c95 100644 --- a/db/languages.yml +++ b/db/languages.yml @@ -119,6 +119,9 @@ python: pypy3: name: "Python 3.6 (PyPy 7.3)" interpreter: /usr/bin/pypy3 + pypy3.11: + name: "Python 3.11 (PyPy)" + interpreter: /usr/bin/pypy3.11 ruby: name: Ruby diff --git a/script/install/debootstrap.bash b/script/install/debootstrap.bash index aa060fb1c..d8538ba80 100644 --- a/script/install/debootstrap.bash +++ b/script/install/debootstrap.bash @@ -174,6 +174,25 @@ chroot "$ISOLATE_ROOT" apt-get install ruby # Ruby (ruby) echo "$chroot_install pypy3" chroot "$ISOLATE_ROOT" apt-get install pypy3 + # Detect architecture + ARCH=$(uname -m) + + # Determine URL based on architecture + if [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + URL="https://downloads.python.org/pypy/pypy3.11-v7.3.20-aarch64.tar.bz2" + FILE="pypy3.11-v7.3.20-aarch64.tar.bz2" + else + URL="https://downloads.python.org/pypy/pypy3.11-v7.3.20-linux64.tar.bz2" + FILE="pypy3.11-v7.3.20-linux64.tar.bz2" + fi + + echo "Installing PyPy 3.11 for $ARCH" + wget -O $FILE $URL + mkdir -p $ISOLATE_ROOT/opt/pypy/3.11 + tar --strip-components=1 -xvf $FILE -C $ISOLATE_ROOT/opt/pypy/3.11 + rm $FILE + chroot "$ISOLATE_ROOT" ln -sf /opt/pypy/3.11/bin/pypy3 /usr/bin/pypy3.11 + echo "$chroot_install ruby2.2" chroot "$ISOLATE_ROOT" apt-get install ruby2.2