Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 25 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
7 changes: 5 additions & 2 deletions scripts/compile_mo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading