From 9d760b70ad0079c5abee5c65ce0b15dc71b27f3c Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Mon, 30 Nov 2015 20:59:38 +0100 Subject: [PATCH 1/3] return extension metadata see http://sphinx-doc.org/latest/extdev/index.html --- lib/matplotlib/sphinxext/plot_directive.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/sphinxext/plot_directive.py b/lib/matplotlib/sphinxext/plot_directive.py index ad21c43e159f..a44b0d61d0b4 100644 --- a/lib/matplotlib/sphinxext/plot_directive.py +++ b/lib/matplotlib/sphinxext/plot_directive.py @@ -280,6 +280,9 @@ def setup(app): app.connect(str('doctree-read'), mark_plot_labels) + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata + #------------------------------------------------------------------------------ # Doctest handling #------------------------------------------------------------------------------ From 8e146f1a1aec738a13fa052f991ffe4827110b75 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 1 Dec 2015 10:31:10 -0500 Subject: [PATCH 2/3] Parallel docs building --- doc/make.py | 6 ++++-- doc/sphinxext/math_symbol_table.py | 3 +++ lib/matplotlib/sphinxext/mathmpl.py | 3 +++ lib/matplotlib/sphinxext/only_directives.py | 3 +++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index 55942734d712..5337e026b240 100755 --- a/doc/make.py +++ b/doc/make.py @@ -2,6 +2,7 @@ from __future__ import print_function import glob +import multiprocessing import os import shutil import sys @@ -45,7 +46,8 @@ def html(buildername='html'): options = '' if warnings_as_errors: options = options + ' -W' - if os.system('sphinx-build %s -b %s -d build/doctrees . build/%s' % (options, buildername, buildername)): + if os.system('sphinx-build -j %d %s -b %s -d build/doctrees . build/%s' % ( + multiprocessing.cpu_count(), options, buildername, buildername)): raise SystemExit("Building HTML failed.") # Clean out PDF files from the _images directory @@ -60,7 +62,7 @@ def htmlhelp(): with open('build/htmlhelp/index.html', 'r+') as fh: content = fh.read() fh.seek(0) - content = re.sub(r'', '', content, + content = re.sub(r'', '', content, flags=re.MULTILINE| re.DOTALL) fh.write(content) fh.truncate() diff --git a/doc/sphinxext/math_symbol_table.py b/doc/sphinxext/math_symbol_table.py index 339d43c6f38a..d0edb7c4b1ae 100644 --- a/doc/sphinxext/math_symbol_table.py +++ b/doc/sphinxext/math_symbol_table.py @@ -138,6 +138,9 @@ def setup(app): 'math_symbol_table', math_symbol_table_directive, False, (0, 1, 0)) + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata + if __name__ == "__main__": # Do some verification of the tables from matplotlib import _mathtext_data diff --git a/lib/matplotlib/sphinxext/mathmpl.py b/lib/matplotlib/sphinxext/mathmpl.py index f44c1d75625a..dddf0f473ed9 100644 --- a/lib/matplotlib/sphinxext/mathmpl.py +++ b/lib/matplotlib/sphinxext/mathmpl.py @@ -119,3 +119,6 @@ def depart_latex_math_latex(self, node): app.add_role('math', math_role) app.add_directive('math', math_directive, True, (0, 0, 0), **options_spec) + + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata diff --git a/lib/matplotlib/sphinxext/only_directives.py b/lib/matplotlib/sphinxext/only_directives.py index fdc8000ab9b1..3f7c63314db0 100644 --- a/lib/matplotlib/sphinxext/only_directives.py +++ b/lib/matplotlib/sphinxext/only_directives.py @@ -66,3 +66,6 @@ def depart_ignore(self, node): app.add_node(html_only, latex=(visit_ignore, depart_ignore)) app.add_node(latex_only, latex=(visit_perform, depart_perform)) app.add_node(latex_only, html=(visit_ignore, depart_ignore)) + + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata From ef972d67aa52a1c683a7a9a36a3b7da1340dd53d Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 22 Dec 2015 16:32:10 -0500 Subject: [PATCH 3/3] Set metadata in more extensions --- doc/sphinxext/gen_gallery.py | 3 +++ doc/sphinxext/gen_rst.py | 3 +++ doc/sphinxext/github.py | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/sphinxext/gen_gallery.py b/doc/sphinxext/gen_gallery.py index 54cf342d1f71..9992e788f2f3 100644 --- a/doc/sphinxext/gen_gallery.py +++ b/doc/sphinxext/gen_gallery.py @@ -168,3 +168,6 @@ def setup(app): app.add_config_value('mpl_example_sections', [], True) except sphinx.errors.ExtensionError: pass # mpl_example_sections already defined + + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata diff --git a/doc/sphinxext/gen_rst.py b/doc/sphinxext/gen_rst.py index 42598d2149f7..eff0709f1b6f 100644 --- a/doc/sphinxext/gen_rst.py +++ b/doc/sphinxext/gen_rst.py @@ -169,3 +169,6 @@ def setup(app): app.add_config_value('mpl_example_sections', [], True) except sphinx.errors.ExtensionError: pass # mpl_example_sections already defined + + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata diff --git a/doc/sphinxext/github.py b/doc/sphinxext/github.py index 519e146d198f..8f0ffc0d9782 100644 --- a/doc/sphinxext/github.py +++ b/doc/sphinxext/github.py @@ -143,7 +143,7 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]): def setup(app): """Install the plugin. - + :param app: Sphinx application context. """ app.info('Initializing GitHub plugin') @@ -152,4 +152,6 @@ def setup(app): app.add_role('ghuser', ghuser_role) app.add_role('ghcommit', ghcommit_role) app.add_config_value('github_project_url', None, 'env') - return + + metadata = {'parallel_read_safe': True, 'parallel_write_safe': True} + return metadata