diff --git a/requirements.txt b/requirements.txt index d8c4e144f..b96c08251 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,4 @@ potodo==0.21.3 powrap==1.0.1 sphinx-intl==2.2.0 -# avoid unnecessary parentheses search in old Python Docs -sphinx-lint==1.0.0; python_version >= "3.12" -sphinx-lint==0.9.1; python_version < "3.12" +sphinx-lint==1.0.0 diff --git a/scripts/lint.sh b/scripts/lint.sh index 927f8e5a5..3748d01a3 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -20,13 +20,17 @@ touch logs/sphinxlint.txt cd cpython/Doc -# Disable literal blocks and update PO -sed -i "/^\s*'literal-block',/s/ '/ #'/" conf.py -# TODO: use `make -C .. gettext` when there are only Python >= 3.12 -opts='-E -b gettext -q -D gettext_compact=0 -d build/.doctrees . build/gettext' -make build ALLSPHINXOPTS="$opts" -# Update translation files with latest POT -sphinx-intl update -p build/gettext -l ${PYDOC_LANGUAGE} > /dev/null +# If version is 3.12 or newer, then disable literal-block, generate POT and +# update translations with fresh POT files. If version 3.11 or older, +# disable new 'unnecessary-parentheses' check, not fixed before these versions. +minor_version=$(git branch --show-current | sed 's|^3\.||') +if [ $minor_version -ge 12 ]; then + sed -i "/^\s*'literal-block',/s/ '/ #'/" conf.py + make gettext SPHINXOPTS='-q' + sphinx-intl update -p build/gettext -l ${PYDOC_LANGUAGE} > /dev/null +else + alias sphinx-lint='sphinx-lint --disable unnecessary-parentheses' +fi cd locales/${PYDOC_LANGUAGE}/LC_MESSAGES set +e
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: