@@ -78,7 +78,7 @@ class DocBuilder:
78
78
script.
79
79
"""
80
80
def __init__ (self , num_jobs = 1 , include_api = True , single_doc = None ,
81
- verbosity = 0 ):
81
+ verbosity = 0 , allow_warnings = False ):
82
82
self .num_jobs = num_jobs
83
83
self .include_api = include_api
84
84
self .verbosity = verbosity
@@ -87,6 +87,7 @@ def __init__(self, num_jobs=1, include_api=True, single_doc=None,
87
87
if single_doc is not None :
88
88
self ._process_single_doc (single_doc )
89
89
self .exclude_patterns = self ._exclude_patterns
90
+ self .allow_warnings = allow_warnings
90
91
91
92
self ._generate_index ()
92
93
if self .single_doc_type == 'docstring' :
@@ -233,10 +234,10 @@ def _sphinx_build(self, kind):
233
234
if kind not in ('html' , 'latex' , 'spelling' ):
234
235
raise ValueError ('kind must be html, latex or '
235
236
'spelling, not {}' .format (kind ))
236
-
237
237
self ._run_os ('sphinx-build' ,
238
238
'-j{}' .format (self .num_jobs ),
239
239
'-b{}' .format (kind ),
240
+ '{}' .format ("" if self .allow_warnings else "-W" ),
240
241
'-{}' .format (
241
242
'v' * self .verbosity ) if self .verbosity else '' ,
242
243
'-d{}' .format (os .path .join (BUILD_PATH , 'doctrees' )),
@@ -355,6 +356,10 @@ def main():
355
356
argparser .add_argument ('-v' , action = 'count' , dest = 'verbosity' , default = 0 ,
356
357
help = ('increase verbosity (can be repeated), '
357
358
'passed to the sphinx build command' ))
359
+ argparser .add_argument ("--allow-warnings" ,
360
+ default = False ,
361
+ action = "store_true" ,
362
+ help = "Whether to allow warnings in the build." )
358
363
args = argparser .parse_args ()
359
364
360
365
if args .command not in cmds :
@@ -374,7 +379,7 @@ def main():
374
379
os .environ ['MPLBACKEND' ] = 'module://matplotlib.backends.backend_agg'
375
380
376
381
builder = DocBuilder (args .num_jobs , not args .no_api , args .single ,
377
- args .verbosity )
382
+ args .verbosity , args . allow_warnings )
378
383
getattr (builder , args .command )()
379
384
380
385
0 commit comments