Skip to content

Commit cd79519

Browse files
Marti Bolivarcarlescufi
authored andcommitted
doc: fix parallel builds
Several of our extensions don't declare they are parallel read or write safe. Upon inspection, they are. Not declaring parallel read safety defeats a lot of the speed ups that are possible when using SPHINXOPTS="-j=auto", so mark the extensions safe and get the performance back. Signed-off-by: Marti Bolivar <[email protected]>
1 parent 74a2d2b commit cd79519

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

doc/extensions/only/eager_only.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def run(self, *args):
3131
# Evaluate the condition eagerly, and if false return no nodes right away
3232
env = self.state.document.settings.env
3333
env.app.builder.tags.add('TRUE')
34-
#print(repr(self.arguments[0]))
34+
3535
if not env.app.builder.tags.eval_condition(self.arguments[0]):
3636
return []
3737

@@ -44,3 +44,13 @@ def run(self, *args):
4444

4545
def setup(app):
4646
directives.register_directive('only', EagerOnly)
47+
48+
# The tags.add call above is setting tags.tags['TRUE'] = True.
49+
# The operation is idempotent and will have taken effect before
50+
# the next eval_condition() which may rely on it so this is thread
51+
# safe both for read and writes (all other operations are local to
52+
# the local nodes variable).
53+
return {
54+
'parallel_read_safe': True,
55+
'parallel_write_safe': True,
56+
}

doc/extensions/zephyr/html_redirects.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ def setup(app):
4343
app.add_config_value('html_redirect_pages', [], 'html')
4444
app.connect('build-finished', create_redirect_pages)
4545

46+
# Since we're just setting up a build-finished hook, which runs
47+
# after both reading and writing, this extension is safe for both.
48+
return {
49+
'parallel_read_safe': True,
50+
'parallel_write_safe': True,
51+
}
52+
4653

4754
def create_redirect_pages(app, docname):
4855
if not isinstance(app.builder, StandaloneHTMLBuilder):

doc/extensions/zephyr/link-roles.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ def setup(app):
2727
app.add_role('zephyr_file', autolink('{}/blob/{}/%s'.format(baseurl, rev)))
2828
app.add_role('zephyr_raw', autolink('{}/raw/{}/%s'.format(baseurl, rev)))
2929

30+
# The role just creates new nodes based on information in the
31+
# arguments; its behavior doesn't depend on any other documents.
32+
return {
33+
'parallel_read_safe': True,
34+
'parallel_write_safe': True,
35+
}
36+
3037

3138
def autolink(pattern):
3239
def role(name, rawtext, text, lineno, inliner, options={}, content=[]):

0 commit comments

Comments
 (0)