Skip to content

Commit

Permalink
Add support for Python Docs 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
rffontenelle committed Jan 28, 2025
1 parent b86b9c5 commit 8ae5d51
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,23 @@ 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

# 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
8 changes: 8 additions & 0 deletions scripts/generate_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
17 changes: 17 additions & 0 deletions scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 8ae5d51

Please sign in to comment.