Skip to content

DOC: small updates to make.py script #19951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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