@@ -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
147148small_docs = False
148149warnings_as_errors = True
150+ n_proc = 1
149151
150152# Change directory to the one containing this file
151153current_dir = os .getcwd ()
@@ -195,11 +197,16 @@ def all():
195197parser .add_argument ("--allowsphinxwarnings" ,
196198 help = "Don't turn Sphinx warnings into errors" ,
197199 action = "store_true" )
200+ parser .add_argument ("-n" ,
201+ help = "Number of parallel workers to use" )
202+
198203args = parser .parse_args ()
199204if args .small :
200205 small_docs = True
201206if args .allowsphinxwarnings :
202207 warnings_as_errors = False
208+ if args .n is not None :
209+ n_proc = int (args .n )
203210
204211if args .cmd :
205212 for command in args .cmd :
0 commit comments