File tree Expand file tree Collapse file tree 4 files changed +39
-1
lines changed
Misc/NEWS.d/next/Documentation Expand file tree Collapse file tree 4 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 6666 run : |
6767 set -Eeuo pipefail
6868 # Build docs with the nit-picky option; write warnings to file
69- make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --fail-on-warning -- warning-file sphinx-warnings.txt" html
69+ make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet --nitpicky --warning-file sphinx-warnings.txt" html
7070 - name : ' Check warnings'
7171 if : github.event_name == 'pull_request'
7272 run : |
7575 --fail-if-regression \
7676 --fail-if-improved \
7777 --fail-if-new-news-nit
78+ - name : ' Build EPUB documentation'
79+ continue-on-error : true
80+ run : |
81+ set -Eeuo pipefail
82+ make -C Doc/ PYTHON=../python SPHINXOPTS="--quiet" epub
83+ pip install epubcheck
84+ epubcheck Doc/build/epub/Python.epub &> Doc/epubcheck.txt
85+ - name : ' Check for fatal errors in EPUB'
86+ if : github.event_name == 'pull_request'
87+ continue-on-error : true # until gh-136155 is fixed
88+ run : |
89+ python Doc/tools/check-epub.py
7890
7991 # Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
8092 doctest :
Original file line number Diff line number Diff line change 448448
449449epub_author = 'Python Documentation Authors'
450450epub_publisher = 'Python Software Foundation'
451+ epub_exclude_files = ('index.xhtml' , 'download.xhtml' )
451452
452453# index pages are not valid xhtml
453454# https://github.com/sphinx-doc/sphinx/issues/12359
Original file line number Diff line number Diff line change 1+ import sys
2+ from pathlib import Path
3+
4+
5+ def main () -> int :
6+ wrong_directory_msg = "Must run this script from the repo root"
7+ if not Path ("Doc" ).exists () or not Path ("Doc" ).is_dir ():
8+ raise RuntimeError (wrong_directory_msg )
9+
10+ with Path ("Doc/epubcheck.txt" ).open (encoding = "UTF-8" ) as f :
11+ messages = [message .split (" - " ) for message in f .read ().splitlines ()]
12+
13+ fatal_errors = [message for message in messages if message [0 ] == "FATAL" ]
14+
15+ if fatal_errors :
16+ print ("\n Error: must not contain fatal errors:\n " )
17+ for error in fatal_errors :
18+ print (" - " .join (error ))
19+
20+ return len (fatal_errors )
21+
22+
23+ if __name__ == "__main__" :
24+ sys .exit (main ())
Original file line number Diff line number Diff line change 1+ We are now checking for fatal errors in EPUB builds in CI.
You can’t perform that action at this time.
0 commit comments