Skip to content

Doc parallel build #6993

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 4 commits into from
Aug 29, 2016
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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' % (
n_proc, options, buildername, buildername)):
raise SystemExit("Building HTML failed.")

# Clean out PDF files from the _images directory
Expand All @@ -67,7 +68,7 @@ def htmlhelp():
with open('build/htmlhelp/index.html', 'r+') as fh:
content = fh.read()
fh.seek(0)
content = re.sub(r'<script>.*?</script>', '', content,
content = re.sub(r'<script>.*?</script>', '', content,
flags=re.MULTILINE| re.DOTALL)
fh.write(content)
fh.truncate()
Expand Down Expand Up @@ -146,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()
Expand Down Expand Up @@ -194,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:
Expand Down
3 changes: 3 additions & 0 deletions doc/sphinxext/gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions doc/sphinxext/gen_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions doc/sphinxext/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
3 changes: 3 additions & 0 deletions doc/sphinxext/math_symbol_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/matplotlib/sphinxext/mathmpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 7 additions & 6 deletions lib/matplotlib/sphinxext/only_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -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