Thanks to visit codestin.com
Credit goes to github.com

Skip to content

lint: Disable literal-block only on 3.12 or newer #241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
18 changes: 11 additions & 7 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading