|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set -ex |
| 4 | + |
| 5 | +pythonVersion="$1" |
| 6 | +locale="$2" |
| 7 | + |
| 8 | +echo"Python Version:$pythonVersion" |
| 9 | +echo"Locale:$locale" |
| 10 | + |
| 11 | +cur=$(pwd) |
| 12 | +git clone --depth=1 --branch="$pythonVersion" https://github.com/python/cpython cpython |
| 13 | +git clone --branch="$pythonVersion" https://github.com/"$GITHUB_REPOSITORY" docs |
| 14 | + |
| 15 | +if [[-n"$TRANSIFEX_APIKEY" ]];then |
| 16 | + cat>~/.transifexrc<<EOF |
| 17 | +[https://www.transifex.com] |
| 18 | +api_hostname = https://api.transifex.com |
| 19 | +hostname = https://www.transifex.com |
| 20 | +password =$TRANSIFEX_APIKEY |
| 21 | +username = api |
| 22 | +EOF |
| 23 | +fi |
| 24 | + |
| 25 | +# Pull Transifex translation |
| 26 | +pushd docs||exit 1 |
| 27 | +tx pull --force --parallel --language"$locale" |
| 28 | +popd||exit 1 |
| 29 | + |
| 30 | +# Test building docs |
| 31 | +pushd cpython/Doc||exit 1 |
| 32 | +mkdir -p locales/"$locale"/ |
| 33 | +ln -sfn"$cur"/docs locales/"$locale"/LC_MESSAGES |
| 34 | +make venv |
| 35 | +make html SPHINXOPTS="-D language=$locale -D gettext_compact=0 -j4 -W --keep-going" |
| 36 | +popd||exit 1 |