cleanup *.pyc files in docs tox envs

.pyc files are ignored by nova's .gitignore, as a result
if you change branches after the .pyc files are generated
for example from stable/ocata to master it does not remove
the .pyc files.

This can lead to the _validate_bytecode_header function that
is invoked as part of sphinx-build to fail as the .pyc
files no longer match the contents of the checked out files.

This change adds {[testenv]commands} to the docs envs
to clean up stale .pyc files before running sphinx-build

Change-Id: I536a260da639d32afbc998be220305f9489db375
This commit is contained in:
Sean Mooney 2019-02-06 16:22:12 +00:00
parent bcfd2439ba
commit a32ccce6de
1 changed files with 4 additions and 0 deletions

View File

@ -195,6 +195,7 @@ description =
Build main documentation.
deps = -r{toxinidir}/doc/requirements.txt
commands =
{[testenv]commands}
rm -rf doc/build
# Check that all JSON files don't have \r\n in line.
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
@ -210,6 +211,7 @@ description =
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
{[testenv]commands}
rm -rf api-guide/build
sphinx-build -W -b html -d api-guide/build/doctrees api-guide/source api-guide/build/html
@ -219,6 +221,7 @@ description =
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
{[testenv]commands}
rm -rf api-ref/build
sphinx-build -W -b html -d api-ref/build/doctrees api-ref/source api-ref/build/html
@ -228,6 +231,7 @@ description =
envdir = {toxworkdir}/docs
deps = {[testenv:docs]deps}
commands =
{[testenv]commands}
rm -rf releasenotes/build
sphinx-build -W -b html -d releasenotes/build/doctrees releasenotes/source releasenotes/build/html