From 10bbf1c1747857b5946045574e65ce1ba977bb0e Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 1 Dec 2015 10:31:10 -0500 Subject: [PATCH 1/4] 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 | 13 +++++++------ 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/doc/make.py b/doc/make.py index d41d786bdb62..88bf32313381 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 @@ -52,7 +53,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 @@ -67,7 +69,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 39b6694ba3fe..26968cb03e54 100644 --- a/lib/matplotlib/sphinxext/mathmpl.py +++ b/lib/matplotlib/sphinxext/mathmpl.py @@ -118,3 +118,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 99978a0b53df..d3070261ddc7 100644 --- a/lib/matplotlib/sphinxext/only_directives.py +++ b/lib/matplotlib/sphinxext/only_directives.py @@ -64,9 +64,10 @@ def visit_ignore(self, node): def depart_ignore(self, node): node.children = [] - app.add_node(html_only, - html=(visit_perform, depart_perform), - latex=(visit_ignore, depart_ignore)) - app.add_node(latex_only, - latex=(visit_perform, depart_perform), - html=(visit_ignore, depart_ignore)) + app.add_node(html_only, html=(visit_perform, depart_perform)) + 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 3f0af1995be5ca14dc99b948416b7ba7a0653fe4 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Tue, 22 Dec 2015 16:32:10 -0500 Subject: [PATCH 2/4] 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 From 26638c90999415bbc50ea7751b1a683749e94563 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 28 Aug 2016 13:50:47 -0400 Subject: [PATCH 3/4] CI: only use 2 cpu on travis --- doc/make.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/make.py b/doc/make.py index 88bf32313381..db62c608b49d 100755 --- a/doc/make.py +++ b/doc/make.py @@ -2,7 +2,6 @@ from __future__ import print_function import glob -import multiprocessing import os import shutil import sys @@ -54,7 +53,7 @@ def html(buildername='html'): if warnings_as_errors: options = options + ' -W' if os.system('sphinx-build -j %d %s -b %s -d build/doctrees . build/%s' % ( - multiprocessing.cpu_count(), options, buildername, buildername)): + 2, options, buildername, buildername)): raise SystemExit("Building HTML failed.") # Clean out PDF files from the _images directory From 08d4b1998b6f2b0d7937f41ea241f4190363352c Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 28 Aug 2016 14:10:01 -0400 Subject: [PATCH 4/4] BLD: add -n flag to control parallel doc build --- .travis.yml | 2 +- doc/make.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06ab039530c6..74c99efe8690 100644 --- a/.travis.yml +++ b/.travis.yml @@ -142,7 +142,7 @@ script: gdb -return-child-result -batch -ex r -ex bt --args python tests.py -s --processes=$NPROC --process-timeout=300 $TEST_ARGS else cd doc - python make.py html + python make.py html -n 2 # We don't build the LaTeX docs here, so linkchecker will complain touch build/html/Matplotlib.pdf linkchecker build/html/index.html diff --git a/doc/make.py b/doc/make.py index db62c608b49d..aa00ad1b4a9d 100755 --- a/doc/make.py +++ b/doc/make.py @@ -53,7 +53,7 @@ def html(buildername='html'): if warnings_as_errors: options = options + ' -W' if os.system('sphinx-build -j %d %s -b %s -d build/doctrees . build/%s' % ( - 2, options, buildername, buildername)): + n_proc, options, buildername, buildername)): raise SystemExit("Building HTML failed.") # Clean out PDF files from the _images directory @@ -147,6 +147,7 @@ def all(): small_docs = False warnings_as_errors = True +n_proc = 1 # Change directory to the one containing this file current_dir = os.getcwd() @@ -195,11 +196,16 @@ def all(): parser.add_argument("--allowsphinxwarnings", help="Don't turn Sphinx warnings into errors", action="store_true") +parser.add_argument("-n", + help="Number of parallel workers to use") + args = parser.parse_args() if args.small: small_docs = True if args.allowsphinxwarnings: warnings_as_errors = False +if args.n is not None: + n_proc = int(args.n) if args.cmd: for command in args.cmd: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy