From 8a6bcce6a25bc6018c7c1b4b153ab241c5a84912 Mon Sep 17 00:00:00 2001 From: Stan Ulbrych Date: Sun, 21 Jun 2026 14:33:42 +0100 Subject: [PATCH 1/2] [3.11] RTD Previews: Get correct base branch for backports (GH-150690) (cherry picked from commit 082ac30eaf51b9b9c218b81b4db71628a487d6c8) Co-authored-by: Stan Ulbrych --- .readthedocs.yml | 50 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 898a9ae89dbb925..95484ca9dfbfd8e 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -11,8 +11,50 @@ build: os: ubuntu-22.04 tools: python: "3" + apt_packages: + - jq - commands: - - make -C Doc venv html - - mkdir _readthedocs - - mv Doc/build/html _readthedocs/html + jobs: + post_system_dependencies: + # https://docs.readthedocs.com/platform/stable/guides/build/skip-build.html#skip-builds-based-on-conditions + # + # Cancel building pull requests when there are no changes in the Doc + # directory or RTD configuration, or if we can't cleanly merge the base + # branch. + - | + set -eEux; + if [ "$READTHEDOCS_VERSION_TYPE" = "external" ]; + then + base_branch=$(wget -qO- "https://api.github.com/repos/python/cpython/pulls/$READTHEDOCS_VERSION" | jq -er ".base.ref"); + git fetch --depth=50 origin $base_branch:origin-$base_branch; + for attempt in $(seq 10); + do + if ! git merge-base HEAD origin-$base_branch; + then + git fetch --deepen=50 origin $base_branch; + else + break; + fi; + done; + if ! git -c "user.name=rtd" -c "user.email=no-reply@readthedocs.org" merge --no-stat --no-edit origin-$base_branch; + then + echo "Unsuccessful merge with '$base_branch' branch, skipping the build"; + exit 183; + fi; + if git diff --exit-code --stat origin-$base_branch -- Doc/ .readthedocs.yml; + then + echo "No changes to Doc/ - skipping the build."; + exit 183; + fi; + fi; + create_environment: + - echo "Skipping default environment creation" + install: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + build: + html: + - make -C Doc venv html + - mkdir -p "$READTHEDOCS_OUTPUT" + - mv Doc/build/html "$READTHEDOCS_OUTPUT/" From a0a4aee9134c67cbcd7b436e97ceef9c2c16daa5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Mon, 6 Jul 2026 09:34:15 +0300 Subject: [PATCH 2/2] Bump to ubuntu-24.04 --- .readthedocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 95484ca9dfbfd8e..038417e4bb34385 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -8,7 +8,7 @@ sphinx: configuration: Doc/conf.py build: - os: ubuntu-22.04 + os: ubuntu-24.04 tools: python: "3" apt_packages: