Skip to content

Commit 8ae5d51

Browse files
committed
Add support for Python Docs 3.7
1 parent b86b9c5 commit 8ae5d51

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

scripts/build.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@ set -xeu
77

88
# Fail earlier if required variables are not set
99
test -n ${PYDOC_LANGUAGE+x}
10+
test -n ${PYDOC_VERSION+x}
1011

1112
cd "$(dirname $0)/.."
1213
mkdir -p logs
1314

1415
# If version is 3.12 or older, set gettext_compact.
1516
# This confval is not needed since 3.12.
1617
# In 3.13, its presence messes 3.13's syntax checking (?)
18+
minor_version=${PYDOC_VERSION##*.}
1719
opts="-D language=${PYDOC_LANGUAGE} --keep-going -w ../../logs/sphinxwarnings.txt"
18-
minor_version=$(git -C cpython/Doc branch --show-current | sed 's|^3\.||')
1920
if [ $minor_version -lt 12 ]; then
2021
opts="$opts -D gettext_compact=False"
2122
fi
2223

2324
make -C cpython/Doc html SPHINXOPTS="${opts}"
2425

25-
# Remove empty file
26+
# Remove sphinxwarnings.txt if empty file
2627
if [ ! -s logs/sphinxwarnings.txt ]; then
2728
rm logs/sphinxwarnings.txt
2829
fi

scripts/generate_templates.sh

+8
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ set -xeu
1313
# Fail earlier if required variables are not set (do not expose TX_TOKEN)
1414
test -n ${PYDOC_TX_PROJECT+x}
1515
test -n ${PYDOC_LANGUAGE+x}
16+
test -n ${PYDOC_VERSION+x}
1617

1718
# Make sure to run all commands from CPython docs locales directory
1819
cd $(dirname $0)/../cpython/Doc/locales
1920

21+
# Python 3.7: Add missing sections to satisfy Blurb's check
22+
# Useful if setup.sh was not ran
23+
if [[ ${PYDOC_VERSION} == '3.7' ]] && [ ! -f ../../114553.patch ]; then
24+
curl -L https://github.com/python/cpython/pull/114553.patch -o ../../114553.patch
25+
git apply ../../114553.patch
26+
fi
27+
2028
# Generate message catalog template (.pot) files
2129
# TODO: use `make -C .. gettext` when there are only Python >= 3.12
2230
opts='-E -b gettext -D gettext_compact=0 -d build/.doctrees . build/gettext'

scripts/setup.sh

+17
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,23 @@ set -u
3232
pip install -r requirements.txt
3333
make -C cpython/Doc venv
3434

35+
36+
if [[ ${PYDOC_VERSION} == '3.7' ]]; then
37+
# Fixes circular dependencies that affects Python 3.7, see:
38+
# https://github.com/sphinx-doc/sphinx/issues/11567
39+
# https://github.com/bazelbuild/rules_python/pull/1166
40+
cpython/Doc/venv/bin/pip install \
41+
sphinxcontrib-applehelp==1.0.4 \
42+
sphinxcontrib-devhelp==1.0.2 \
43+
sphinxcontrib-htmlhelp==2.0.1 \
44+
sphinxcontrib-qthelp==1.0.3 \
45+
sphinxcontrib-serializinghtml==1.1.5 \
46+
alabaster==0.7.13
47+
# Add missing sections to satisfy Blurb's check
48+
curl -L https://github.com/python/cpython/pull/114553.patch -o ../../114553.patch
49+
git apply ../../114553.patch
50+
fi
51+
3552
if ! command -v tx > /dev/null; then
3653
echo "WARNING: Transifex CLI tool was not found."
3754
echo "If going to pull translations it is needed, can be ignored otherwise."

0 commit comments

Comments
 (0)