Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ca5ad8

Browse files
authored
Merge pull request #6993 from tacaswell/doc_parallel_build
Doc parallel build
2 parents 018fa1c + 08d4b19 commit 6ca5ad8

File tree

8 files changed

+33
-11
lines changed

8 files changed

+33
-11
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ script:
142142
gdb -return-child-result -batch -ex r -ex bt --args python tests.py -s --processes=$NPROC --process-timeout=300 $TEST_ARGS
143143
else
144144
cd doc
145-
python make.py html
145+
python make.py html -n 2
146146
# We don't build the LaTeX docs here, so linkchecker will complain
147147
touch build/html/Matplotlib.pdf
148148
linkchecker build/html/index.html

doc/make.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def html(buildername='html'):
5252
options = ''
5353
if warnings_as_errors:
5454
options = options + ' -W'
55-
if os.system('sphinx-build %s -b %s -d build/doctrees . build/%s' % (options, buildername, buildername)):
55+
if os.system('sphinx-build -j %d %s -b %s -d build/doctrees . build/%s' % (
56+
n_proc, options, buildername, buildername)):
5657
raise SystemExit("Building HTML failed.")
5758

5859
# Clean out PDF files from the _images directory
@@ -67,7 +68,7 @@ def htmlhelp():
6768
with open('build/htmlhelp/index.html', 'r+') as fh:
6869
content = fh.read()
6970
fh.seek(0)
70-
content = re.sub(r'<script>.*?</script>', '', content,
71+
content = re.sub(r'<script>.*?</script>', '', content,
7172
flags=re.MULTILINE| re.DOTALL)
7273
fh.write(content)
7374
fh.truncate()
@@ -146,6 +147,7 @@ def all():
146147

147148
small_docs = False
148149
warnings_as_errors = True
150+
n_proc = 1
149151

150152
# Change directory to the one containing this file
151153
current_dir = os.getcwd()
@@ -194,11 +196,16 @@ def all():
194196
parser.add_argument("--allowsphinxwarnings",
195197
help="Don't turn Sphinx warnings into errors",
196198
action="store_true")
199+
parser.add_argument("-n",
200+
help="Number of parallel workers to use")
201+
197202
args = parser.parse_args()
198203
if args.small:
199204
small_docs = True
200205
if args.allowsphinxwarnings:
201206
warnings_as_errors = False
207+
if args.n is not None:
208+
n_proc = int(args.n)
202209

203210
if args.cmd:
204211
for command in args.cmd:

doc/sphinxext/gen_gallery.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,6 @@ def setup(app):
168168
app.add_config_value('mpl_example_sections', [], True)
169169
except sphinx.errors.ExtensionError:
170170
pass # mpl_example_sections already defined
171+
172+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
173+
return metadata

doc/sphinxext/gen_rst.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,6 @@ def setup(app):
169169
app.add_config_value('mpl_example_sections', [], True)
170170
except sphinx.errors.ExtensionError:
171171
pass # mpl_example_sections already defined
172+
173+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
174+
return metadata

doc/sphinxext/github.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def ghcommit_role(name, rawtext, text, lineno, inliner, options={}, content=[]):
143143

144144
def setup(app):
145145
"""Install the plugin.
146-
146+
147147
:param app: Sphinx application context.
148148
"""
149149
app.info('Initializing GitHub plugin')
@@ -152,4 +152,6 @@ def setup(app):
152152
app.add_role('ghuser', ghuser_role)
153153
app.add_role('ghcommit', ghcommit_role)
154154
app.add_config_value('github_project_url', None, 'env')
155-
return
155+
156+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
157+
return metadata

doc/sphinxext/math_symbol_table.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ def setup(app):
138138
'math_symbol_table', math_symbol_table_directive,
139139
False, (0, 1, 0))
140140

141+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
142+
return metadata
143+
141144
if __name__ == "__main__":
142145
# Do some verification of the tables
143146
from matplotlib import _mathtext_data

lib/matplotlib/sphinxext/mathmpl.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,6 @@ def depart_latex_math_latex(self, node):
118118
app.add_role('math', math_role)
119119
app.add_directive('math', math_directive,
120120
True, (0, 0, 0), **options_spec)
121+
122+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
123+
return metadata

lib/matplotlib/sphinxext/only_directives.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ def visit_ignore(self, node):
6464
def depart_ignore(self, node):
6565
node.children = []
6666

67-
app.add_node(html_only,
68-
html=(visit_perform, depart_perform),
69-
latex=(visit_ignore, depart_ignore))
70-
app.add_node(latex_only,
71-
latex=(visit_perform, depart_perform),
72-
html=(visit_ignore, depart_ignore))
67+
app.add_node(html_only, html=(visit_perform, depart_perform))
68+
app.add_node(html_only, latex=(visit_ignore, depart_ignore))
69+
app.add_node(latex_only, latex=(visit_perform, depart_perform))
70+
app.add_node(latex_only, html=(visit_ignore, depart_ignore))
71+
72+
metadata = {'parallel_read_safe': True, 'parallel_write_safe': True}
73+
return metadata

0 commit comments

Comments
 (0)