Skip to content

Commit c20d6a3

Browse files
Merge pull request #173 from rscohn2/master
declare the extension as parallel read safe
2 parents 4b1a1a3 + b336330 commit c20d6a3

File tree

9 files changed

+46
-1
lines changed

9 files changed

+46
-1
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ jobs:
4545
run: |
4646
make build-sample
4747
48+
- name: "Build sample parallel"
49+
run: |
50+
make build-sample-parallel
51+
4852
- name: "Run tests"
4953
run: |
5054
pytest -s -vvv --cov-fail-under 100 --cov=src/ --cov=tests tests/ --cov-report=xml

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ build-sample:
2929
rm -rf sample/build
3030
sphinx-build -W -b html sample/source sample/build
3131

32+
.PHONY: build-sample-parallel
33+
build-sample-parallel:
34+
rm -rf sample/build
35+
sphinx-build -j 2 -W -b html sample/source sample/build
36+
3237
.PHONY: open-sample
3338
open-sample:
3439
python -c 'import os, webbrowser; webbrowser.open("file://" + os.path.abspath("sample/build/index.html"))'

sample/source/five.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=======
2+
Five
3+
=======
4+

sample/source/four.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=======
2+
Four
3+
=======
4+

sample/source/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,18 @@ Inline ``:code:``
7171
:code:`echo "The author is |author|"`
7272

7373
:substitution-code:`echo "The author is |author|"`
74+
75+
..
76+
77+
This is a test of parallel document builds. You need at least 5
78+
documents. See:
79+
https://github.com/adamtheturtle/sphinx-substitution-extensions/pull/173
80+
81+
.. toctree::
82+
:hidden:
83+
84+
one
85+
two
86+
three
87+
four
88+
five

sample/source/one.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=====
2+
One
3+
=====
4+

sample/source/three.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=======
2+
Three
3+
=======
4+

sample/source/two.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
=====
2+
Two
3+
=====
4+

src/sphinx_substitution_extensions/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,12 @@ def substitution_code_role( # pylint: disable=dangerous-default-value
146146
}
147147

148148

149-
def setup(app: Sphinx) -> None:
149+
def setup(app: Sphinx) -> dict:
150150
"""
151151
Add the custom directives to Sphinx.
152152
"""
153153
app.add_config_value('substitutions', [], 'html')
154154
directives.register_directive('prompt', SubstitutionPrompt)
155155
directives.register_directive('code-block', SubstitutionCodeBlock)
156156
app.add_role('substitution-code', substitution_code_role)
157+
return {'parallel_read_safe': True}

0 commit comments

Comments
 (0)