Skip to content
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

Docs: debug broken docs build #6007

Merged
merged 3 commits into from
Sep 18, 2018
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
16 changes: 11 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
import pkg_resources
import shutil

from sphinx.util import logging

logger = logging.getLogger(__name__)

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
Expand Down Expand Up @@ -325,18 +329,20 @@
# See: https://tech.signavio.com/2017/managing-sphinx-redirects
# HTML pages to be copied from source to target
static_html_pages = [
'datastore.usage.html',
'datastore/usage.html',
'bigquery/usage.html',
'spanner/usage.html',
]

def copy_static_html_pages(app, docname):
if app.builder.name == 'html':
def copy_static_html_pages(app, exception):
if exception is None and app.builder.name == 'html':
for static_html_page in static_html_pages:
target_path = app.outdir + '/' + static_html_page
src_path = app.srcdir + '/' + static_html_page
if os.path.isfile(src_path):
shutil.copyfile(src_path, target_path)
if os.path.isfile(src_path):
logger.info(
'Copying static html: %s -> %s', src_path, target_path)
shutil.copyfile(src_path, target_path)

def setup(app):
app.connect('build-finished', copy_static_html_pages)
10 changes: 9 additions & 1 deletion test_utils/scripts/update_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function build_docs {
rm -rf docs/_build/
rm -rf docs/bigquery/generated
sphinx-build -W -b html -d docs/_build/doctrees docs/ docs/_build/html/
# -W -> warnings as errors
# -T -> show full traceback on exception
# -N -> no color
sphinx-build \
-W -T -N \
-b html \
-d docs/_build/doctrees \
docs/ \
docs/_build/html/
return $?
}

Expand Down