Skip to content

Commit

Permalink
DOC: small updates to make.py script (pandas-dev#19951)
Browse files Browse the repository at this point in the history
* enable passing verbosity flag to sphinx

* alias api for api.rst
  • Loading branch information
jorisvandenbossche committed Mar 2, 2018
1 parent d1f3689 commit 0bfb61b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ class DocBuilder:
All public methods of this class can be called as parameters of the
script.
"""
def __init__(self, num_jobs=1, include_api=True, single_doc=None):
def __init__(self, num_jobs=1, include_api=True, single_doc=None,
verbosity=0):
self.num_jobs = num_jobs
self.include_api = include_api
self.verbosity = verbosity
self.single_doc = None
self.single_doc_type = None
if single_doc is not None:
Expand Down Expand Up @@ -120,7 +122,7 @@ def _process_single_doc(self, single_doc):
"""
self.include_api = False

if single_doc == 'api.rst':
if single_doc == 'api.rst' or single_doc == 'api':
self.single_doc_type = 'api'
self.single_doc = 'api'
elif os.path.exists(os.path.join(SOURCE_PATH, single_doc)):
Expand Down Expand Up @@ -229,6 +231,8 @@ def _sphinx_build(self, kind):
self._run_os('sphinx-build',
'-j{}'.format(self.num_jobs),
'-b{}'.format(kind),
'-{}'.format(
'v' * self.verbosity) if self.verbosity else '',
'-d{}'.format(os.path.join(BUILD_PATH, 'doctrees')),
'-Dexclude_patterns={}'.format(self.exclude_patterns),
SOURCE_PATH,
Expand Down Expand Up @@ -330,6 +334,9 @@ def main():
type=str,
default=os.path.join(DOC_PATH, '..'),
help='path')
argparser.add_argument('-v', action='count', dest='verbosity', default=0,
help=('increase verbosity (can be repeated), '
'passed to the sphinx build command'))
args = argparser.parse_args()

if args.command not in cmds:
Expand All @@ -338,9 +345,9 @@ def main():

os.environ['PYTHONPATH'] = args.python_path

getattr(DocBuilder(args.num_jobs,
not args.no_api,
args.single), args.command)()
builder = DocBuilder(args.num_jobs, not args.no_api, args.single,
args.verbosity)
getattr(builder, args.command)()


if __name__ == '__main__':
Expand Down

0 comments on commit 0bfb61b

Please sign in to comment.