Add an --outdated flag to the build_docs.py script, which sets the 'outdated' value within HTML templates. #86
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This branch supports work on python/steering-council#3.
My cpython PR python/cpython#19229 adds a header to the top of each documentation page if the
outdated
variable is set. This branch changes the build process so that theoutdated
variable is set automatically for 2.7 releases when building the full set of documentation. The outdated variable can also be set when building a single release, using the--outdated
command-line flag.I've never used this script before, so I tried a number of strategies to test this change. For all of these I used specially created subdirectories to store the logs, checkouts, and HTML output, rather than using the defaults in
/srv/
and/var/
. I also passed my own user group asgroup
since I don't have adocs
group on my machine.-A outdated=1
as one of the SPHINXOPTS:./build_docs.py --group=leonardr --log-directory=logs --www-root=output --languages en --branch=2.7 -q -o --build-root=../versions/
Here's the relevant output (my addition is bolded):
DEBUG:Running command ['make', '-C', '/home/leonardr/programming/psf/versions/2.7/cpython-en/Doc', 'PYTHON=/home/leonardr/programming/psf/versions/venv/bin/python', 'SPHINXBUILD=/home/leonardr/programming/psf/versions/venv/bin/sphinx-build', 'BLURB=/home/leonardr/programming/psf/versions/venv/bin/blurb', 'VENVDIR=/home/leonardr/programming/psf/versions/venv', 'SPHINXOPTS=-D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -q -A outdated=1', 'SPHINXERRORHANDLING=', 'autobuild-stable-html']
./build_docs.py --group=leonardr --log-directory=logs --www-root=output -q -o --build-root=../versions/
All versions of the Python 2.7 docs were built with
-A outdated=1
:DEBUG:Running command ['make', '-C', '/home/leonardr/programming/psf/versions/2.7/cpython-en/Doc', 'PYTHON=/home/leonardr/programming/psf/versions/venv/bin/python', 'SPHINXBUILD=/home/leonardr/programming/psf/versions/venv/bin/sphinx-build', 'BLURB=/home/leonardr/programming/psf/versions/venv/bin/blurb', 'VENVDIR=/home/leonardr/programming/psf/versions/venv', 'SPHINXOPTS=-D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -q -A outdated=1', 'SPHINXERRORHANDLING=', 'autobuild-stable-html']
Docs for other versions of Python were not:
DEBUG:Running command ['make', '-C', '/home/leonardr/programming/psf/versions/3.9/cpython-zh-tw/Doc', 'PYTHON=/home/leonardr/programming/psf/versions/venv/bin/python', 'SPHINXBUILD=/home/leonardr/programming/psf/versions/venv/bin/sphinx-build', 'BLURB=/home/leonardr/programming/psf/versions/venv/bin/blurb', 'VENVDIR=/home/leonardr/programming/psf/versions/venv', 'SPHINXOPTS=-D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc=\\usepackage{xeCJK} -q -D locale_dirs=/home/leonardr/programming/psf/versions/3.9/locale -D language=zh_TW -D gettext_compact=0', 'SPHINXERRORHANDLING=', 'autobuild-dev-html']
make
command generated by this script to verify that the banner shows up when-A outdated=1
is passed in on the command line.make -C /home/leonardr/programming/psf/versions/2.7/cpython-en/Doc PYTHON=/home/leonardr/programming/psf/versions/venv/bin/python SPHINXBUILD=/home/leonardr/programming/psf/versions/venv/bin/sphinx-build BLURB=/home/leonardr/programming/psf/versions/venv/bin/blurb VENVDIR=/home/leonardr/programming/psf/versions/venv 'SPHINXOPTS=-D latex_engine=xelatex -D latex_elements.inputenc= -D latex_elements.fontenc= -q -A outdated=1' SPHINXERRORHANDLING= autobuild-stable-html
Here's a visual of the final result: