Skip to content

DOC: Make sphinx fail the build when --warnings-are-errors is set #24523

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

Merged
merged 1 commit into from
Dec 31, 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
15 changes: 8 additions & 7 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,12 @@ def _sphinx_build(self, kind):
if self.num_jobs:
cmd += ['-j', str(self.num_jobs)]
if self.warnings_are_errors:
cmd.append('-W')
cmd += ['-W', '--keep-going']
if self.verbosity:
cmd.append('-{}'.format('v' * self.verbosity))
cmd += ['-d', os.path.join(BUILD_PATH, 'doctrees'),
SOURCE_PATH, os.path.join(BUILD_PATH, kind)]
cmd = ['sphinx-build', SOURCE_PATH, os.path.join(BUILD_PATH, kind)]
self._run_os(*cmd)
return subprocess.call(cmd)

def _open_browser(self, single_doc_html):
"""
Expand All @@ -144,13 +143,14 @@ def html(self):
"""
Build HTML documentation.
"""
self._sphinx_build('html')
ret_code = self._sphinx_build('html')
zip_fname = os.path.join(BUILD_PATH, 'html', 'pandas.zip')
if os.path.exists(zip_fname):
os.remove(zip_fname)

if self.single_doc_html is not None:
self._open_browser(self.single_doc_html)
return ret_code

def latex(self, force=False):
"""
Expand All @@ -159,7 +159,7 @@ def latex(self, force=False):
if sys.platform == 'win32':
sys.stderr.write('latex build has not been tested on windows\n')
else:
self._sphinx_build('latex')
ret_code = self._sphinx_build('latex')
os.chdir(os.path.join(BUILD_PATH, 'latex'))
if force:
for i in range(3):
Expand All @@ -170,12 +170,13 @@ def latex(self, force=False):
'"build/latex/pandas.pdf" for problems.')
else:
self._run_os('make')
return ret_code

def latex_forced(self):
"""
Build PDF documentation with retries to find missing references.
"""
self.latex(force=True)
return self.latex(force=True)

@staticmethod
def clean():
Expand Down Expand Up @@ -257,7 +258,7 @@ def main():

builder = DocBuilder(args.num_jobs, not args.no_api, args.single,
args.verbosity, args.warnings_are_errors)
getattr(builder, args.command)()
return getattr(builder, args.command)()


if __name__ == '__main__':
Expand Down
4 changes: 4 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,10 @@ def process_class_docstrings(app, what, name, obj, options, lines):
# suppress this warning.
'app.add_directive'
]
if pattern:
# When building a single document we don't want to warn because references
# to other documents are unknown, as it's expected
suppress_warnings.append('ref.ref')


def rstjinja(app, docname, source):
Expand Down