@@ -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 ()
@@ -194,11 +196,16 @@ def all():
194196parser .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+
197202args = parser .parse_args ()
198203if args .small :
199204 small_docs = True
200205if args .allowsphinxwarnings :
201206 warnings_as_errors = False
207+ if args .n is not None :
208+ n_proc = int (args .n )
202209
203210if args .cmd :
204211 for command in args .cmd :
0 commit comments