builddoc: Treat '[pbr] autodoc_tree_excludes' as a multi-line opt

We were treating this a single line, comma- or space-delimited option.
This was incorrect and was causing issues for projects like neutron-lib
when Sphinx 1.7, which switches from optparse to the stricter argparse
was used. In addition, this project was including comments in the
multi-line opt. These were being passed through but Sphinx < 1.7 was
simply ignoring them. These are now filtered out.

Change-Id: I177edf0f44714175da220cf3a960b8f23aa4ab09
Closes-Bug: #1753082
This commit is contained in:
Stephen Finucane 2018-03-12 17:34:58 +00:00 committed by Stephen Finucane
parent 37a1ce7f85
commit 1fe0ceab39
2 changed files with 5 additions and 3 deletions

View File

@ -242,6 +242,8 @@ class LocalBuildDoc(setup_command.BuildDoc):
self.autodoc_tree_excludes = ['setup.py']
def finalize_options(self):
from pbr import util
# Not a new style class, super keyword does not work.
setup_command.BuildDoc.finalize_options(self)
@ -262,8 +264,8 @@ class LocalBuildDoc(setup_command.BuildDoc):
opt = 'autodoc_tree_excludes'
option_dict = self.distribution.get_option_dict('pbr')
if opt in option_dict:
self.autodoc_tree_excludes = option_dict[opt][1]
self.ensure_string_list(opt)
self.autodoc_tree_excludes = util.split_multiline(
option_dict[opt][1])
# handle Sphinx < 1.5.0
if not hasattr(self, 'warning_is_error'):

View File

@ -580,7 +580,7 @@ def split_multiline(value):
value = [element for element in
(line.strip() for line in value.split('\n'))
if element]
if element and not element.startswith('#')]
return value