diff --git a/scripts/build.sh b/scripts/build.sh index ee338368e..44119ba9c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -7,6 +7,7 @@ set -xeu # Fail earlier if required variables are not set test -n ${PYDOC_LANGUAGE+x} +test -n ${PYDOC_VERSION+x} cd "$(dirname $0)/.." mkdir -p logs @@ -14,15 +15,15 @@ mkdir -p logs # If version is 3.12 or older, set gettext_compact. # This confval is not needed since 3.12. # In 3.13, its presence messes 3.13's syntax checking (?) +minor_version=${PYDOC_VERSION##*.} opts="-D language=${PYDOC_LANGUAGE} --keep-going -w ../../logs/sphinxwarnings.txt" -minor_version=$(git -C cpython/Doc branch --show-current | sed 's|^3\.||') if [ $minor_version -lt 12 ]; then opts="$opts -D gettext_compact=False" fi make -C cpython/Doc html SPHINXOPTS="${opts}" -# Remove empty file +# Remove sphinxwarnings.txt if empty file if [ ! -s logs/sphinxwarnings.txt ]; then rm logs/sphinxwarnings.txt fi diff --git a/scripts/generate_templates.sh b/scripts/generate_templates.sh index d1878f411..1f82b71ed 100755 --- a/scripts/generate_templates.sh +++ b/scripts/generate_templates.sh @@ -13,10 +13,18 @@ set -xeu # Fail earlier if required variables are not set (do not expose TX_TOKEN) test -n ${PYDOC_TX_PROJECT+x} test -n ${PYDOC_LANGUAGE+x} +test -n ${PYDOC_VERSION+x} # Make sure to run all commands from CPython docs locales directory cd $(dirname $0)/../cpython/Doc/locales +# Python 3.7: Add missing sections to satisfy Blurb's check +# Useful if setup.sh was not ran +if [[ ${PYDOC_VERSION} == '3.7' ]] && [ ! -f ../../114553.patch ]; then + curl -L https://github.com/python/cpython/pull/114553.patch -o ../../114553.patch + git apply ../../114553.patch +fi + # Generate message catalog template (.pot) files # TODO: use `make -C .. gettext` when there are only Python >= 3.12 opts='-E -b gettext -D gettext_compact=0 -d build/.doctrees . build/gettext' diff --git a/scripts/setup.sh b/scripts/setup.sh index 0c5a95adf..c1c7bc657 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -32,6 +32,23 @@ set -u pip install -r requirements.txt make -C cpython/Doc venv + +if [[ ${PYDOC_VERSION} == '3.7' ]]; then + # Fixes circular dependencies that affects Python 3.7, see: + # https://github.com/sphinx-doc/sphinx/issues/11567 + # https://github.com/bazelbuild/rules_python/pull/1166 + cpython/Doc/venv/bin/pip install \ + sphinxcontrib-applehelp==1.0.4 \ + sphinxcontrib-devhelp==1.0.2 \ + sphinxcontrib-htmlhelp==2.0.1 \ + sphinxcontrib-qthelp==1.0.3 \ + sphinxcontrib-serializinghtml==1.1.5 \ + alabaster==0.7.13 + # Add missing sections to satisfy Blurb's check + curl -L https://github.com/python/cpython/pull/114553.patch -o ../../114553.patch + git apply ../../114553.patch +fi + if ! command -v tx > /dev/null; then echo "WARNING: Transifex CLI tool was not found." echo "If going to pull translations it is needed, can be ignored otherwise."