From 9c8fbf197d676dd91efdd55f5cb61e56c6b427d7 Mon Sep 17 00:00:00 2001 From: Sepehr Rasouli Date: Tue, 18 Aug 2026 13:13:24 +0330 Subject: [PATCH 1/2] Update build and deploy workflow --- .github/workflows/build-and-deploy.yml | 15 ++++----------- scripts/compile_mo.py | 7 +++++-- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ce803c47b..0b7815df0 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -41,17 +41,10 @@ jobs: with: path: Doc/locales/fa/LC_MESSAGES - - name: Strip stray fuzzy markers - run: python3 Doc/locales/fa/LC_MESSAGES/scripts/strip_fuzzy.py $(find Doc/locales/fa/LC_MESSAGES -name "*.po" -not -path "*/.git/*") - - - name: Install gettext - run: sudo apt-get install -y gettext - - - name: Compile .po files to .mo - run: | - find Doc/locales/fa/LC_MESSAGES -name "*.po" -not -path "*/.git/*" | while read f; do - msgfmt "$f" -o "${f%.po}.mo" - done + - name: Strip fuzzy markers and compile .po to .mo + run: find Doc/locales/fa/LC_MESSAGES -name "*.po" -not -path "*/.git/*" | python3 Doc/locales/fa/LC_MESSAGES/scripts/compile_mo.py + env: + MSGFMT_TOOLS_PATH: Tools/i18n - name: Setup problem matcher uses: sphinx-doc/github-problem-matcher@v1.1 diff --git a/scripts/compile_mo.py b/scripts/compile_mo.py index 9eb26df4d..d59a1a8d9 100644 --- a/scripts/compile_mo.py +++ b/scripts/compile_mo.py @@ -16,8 +16,11 @@ import sys import os -# venv/cpython/Tools/i18n/msgfmt.py, relative to repo root. -sys.path.insert(0, os.path.join("venv", "cpython", "Tools", "i18n")) +_venv_tools = os.environ.get( + "MSGFMT_TOOLS_PATH", + os.path.join("venv", "cpython", "Tools", "i18n"), +) +sys.path.insert(0, _venv_tools) import msgfmt # noqa: E402 From 8051f69c413b60340674efec91fa5be5f5480854 Mon Sep 17 00:00:00 2001 From: Sepehr Rasouli Date: Tue, 18 Aug 2026 13:30:50 +0330 Subject: [PATCH 2/2] Skip RTD workflow on non-documentation changes --- .readthedocs.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index bd0d3adf0..6d2628525 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -4,8 +4,31 @@ build: os: ubuntu-24.04 tools: python: "3.12" - commands: + - | + set +e + if git rev-parse --verify -q HEAD^ >/dev/null; then + CHANGED_FILES=$(git diff --name-only HEAD^ HEAD) + else + CHANGED_FILES="" + fi + echo "Changed files: $CHANGED_FILES" + + SKIP=1 + for f in $CHANGED_FILES; do + case "$f" in + *.po|*.yaml|*.yml) + SKIP=0 + ;; + esac + done + + if [ -n "$CHANGED_FILES" ] && [ "$SKIP" -eq 1 ]; then + echo "No documentation-relevant files changed, skipping build." + exit 183 + fi + echo "Continuing build." + exit 0 - git clone --depth 1 --branch v3.14.6 https://github.com/python/cpython venv/cpython - pip install -r venv/cpython/Doc/requirements.txt - mkdir -p venv/cpython/Doc/locales/fa/LC_MESSAGES @@ -20,4 +43,4 @@ build: -D gettext_allow_fuzzy_translations=1 -D html_theme_options.is_rtl=1 venv/cpython/Doc - $READTHEDOCS_OUTPUT/html + $READTHEDOCS_OUTPUT/html \ No newline at end of file