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

Skip to content

Commit 68de5ca

Browse files
authored
Disable literal block when linting (#234)
* Disable literal block translation when linting * Fix exit status for lint.sh * Simplify error output redirect in lint.sh To avoid "Syntax error: redirection unexpected"
1 parent a59954e commit 68de5ca

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

scripts/lint.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,30 @@ cd "$rootdir"
1818
mkdir -p logs
1919
touch logs/sphinxlint.txt
2020

21-
cd cpython/Doc/locale/${PYDOC_LANGUAGE}/LC_MESSAGES
22-
sphinx-lint | tee $(realpath "$rootdir/logs/sphinxlint.txt")
23-
cd $OLDPWD
21+
cd cpython/Doc
2422

25-
# Remove empty file
23+
# Disable literal blocks and update PO
24+
sed -i "/^\s*'literal-block',/s/ '/ #'/" conf.py
25+
# TODO: use `make -C .. gettext` when there are only Python >= 3.12
26+
opts='-E -b gettext -q -D gettext_compact=0 -d build/.doctrees . build/gettext'
27+
make build ALLSPHINXOPTS="$opts"
28+
# Update translation files with latest POT
29+
sphinx-intl update -d locale -p build/gettext -l ${PYDOC_LANGUAGE} > /dev/null
30+
31+
cd locale/${PYDOC_LANGUAGE}/LC_MESSAGES
32+
sphinx-lint 2> $(realpath "$rootdir/logs/sphinxlint.txt")
33+
34+
# Undo changes to undo literal blocks disabling
35+
git checkout .
36+
37+
cd "$rootdir"
38+
39+
# Check of logfile is empty
2640
if [ ! -s logs/sphinxlint.txt ]; then
41+
# OK, it is empty. Remove it.
2742
rm logs/sphinxlint.txt
43+
else
44+
# print contents and exit with error status (to trigger notification in CI)
45+
cat logs/sphinxlint.txt
46+
exit 1
2847
fi

0 commit comments

Comments
 (0)