Skip to content
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

BuildDoc: link verbosity to distutils' #5090

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions sphinx/setup_command.py
Expand Up @@ -105,7 +105,8 @@ def initialize_options(self):
self.config_dir = None # type: unicode
self.link_index = False
self.copyright = ''
self.verbosity = 0
# Link verbosity to distutils' (which uses 1 by default).
self.verbosity = self.distribution.verbose - 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are self.distribution and self.distribution.verbose public API? It seems there are no document for them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems distlib provides Command.distribution and Distribution.verbose since py27 (I just checked in GitHub).
https://github.com/python/cpython/blob/master/Lib/distutils/cmd.py#L61
https://github.com/python/cpython/blob/3.5/Lib/distutils/dist.py#L134

Unfortunately they are not documented. But I suppose it's okay.
https://docs.python.org/3/distutils/apiref.html

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mypy warns this line as following. Could you check this please?:

sphinx/setup_command.py:109:26: error: "BuildDoc" has no attribute "distribution"
https://travis-ci.org/sphinx-doc/sphinx/jobs/391888857#L493

self.traceback = False

def _guess_source_dir(self):
Expand Down Expand Up @@ -185,7 +186,8 @@ def run(self):
builder_target_dir, self.doctree_dir,
builder, confoverrides, status_stream,
freshenv=self.fresh_env,
warningiserror=self.warning_is_error)
warningiserror=self.warning_is_error,
verbosity=self.verbosity)
app.build(force_all=self.all_files)
if app.statuscode:
raise DistutilsExecError(
Expand Down