@@ -78,9 +78,11 @@ class DocBuilder:
78
78
All public methods of this class can be called as parameters of the
79
79
script.
80
80
"""
81
- def __init__ (self , num_jobs = 1 , include_api = True , single_doc = None ):
81
+ def __init__ (self , num_jobs = 1 , include_api = True , single_doc = None ,
82
+ verbosity = 0 ):
82
83
self .num_jobs = num_jobs
83
84
self .include_api = include_api
85
+ self .verbosity = verbosity
84
86
self .single_doc = None
85
87
self .single_doc_type = None
86
88
if single_doc is not None :
@@ -120,7 +122,7 @@ def _process_single_doc(self, single_doc):
120
122
"""
121
123
self .include_api = False
122
124
123
- if single_doc == 'api.rst' :
125
+ if single_doc == 'api.rst' or single_doc == 'api' :
124
126
self .single_doc_type = 'api'
125
127
self .single_doc = 'api'
126
128
elif os .path .exists (os .path .join (SOURCE_PATH , single_doc )):
@@ -229,6 +231,8 @@ def _sphinx_build(self, kind):
229
231
self ._run_os ('sphinx-build' ,
230
232
'-j{}' .format (self .num_jobs ),
231
233
'-b{}' .format (kind ),
234
+ '-{}' .format (
235
+ 'v' * self .verbosity ) if self .verbosity else '' ,
232
236
'-d{}' .format (os .path .join (BUILD_PATH , 'doctrees' )),
233
237
'-Dexclude_patterns={}' .format (self .exclude_patterns ),
234
238
SOURCE_PATH ,
@@ -330,6 +334,9 @@ def main():
330
334
type = str ,
331
335
default = os .path .join (DOC_PATH , '..' ),
332
336
help = 'path' )
337
+ argparser .add_argument ('-v' , action = 'count' , dest = 'verbosity' , default = 0 ,
338
+ help = ('increase verbosity (can be repeated), '
339
+ 'passed to the sphinx build command' ))
333
340
args = argparser .parse_args ()
334
341
335
342
if args .command not in cmds :
@@ -338,9 +345,9 @@ def main():
338
345
339
346
os .environ ['PYTHONPATH' ] = args .python_path
340
347
341
- getattr ( DocBuilder (args .num_jobs ,
342
- not args .no_api ,
343
- args . single ) , args .command )()
348
+ builder = DocBuilder (args .num_jobs , not args . no_api , args . single ,
349
+ args .verbosity )
350
+ getattr ( builder , args .command )()
344
351
345
352
346
353
if __name__ == '__main__' :
0 commit comments