Only modify autoindex.rst if it exists

This fixes doc build errors when using older Sphinx versions.

Change-Id: I0ed9bed311d6309257c0a111671d0fea46f5da7c
Closes-bug: #1387343
This commit is contained in:
Dan Prince 2014-10-29 15:41:31 -04:00
parent 63e618beb1
commit fa52a63e4f

View File

@ -41,13 +41,15 @@ exclude_patterns = [
] ]
# Prune the excluded patterns from the autoindex # Prune the excluded patterns from the autoindex
for line in fileinput.input('api/autoindex.rst', inplace=True): PATH = 'api/autoindex.rst'
found = False if os.path.isfile(PATH) and os.access(PATH, os.R_OK):
for pattern in exclude_patterns: for line in fileinput.input(PATH, inplace=True):
if fnmatch.fnmatch(line, '*' + pattern[4:]): found = False
found = True for pattern in exclude_patterns:
if not found: if fnmatch.fnmatch(line, '*' + pattern[4:]):
print line, found = True
if not found:
print line,
# The suffix of source filenames. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'
@ -91,4 +93,4 @@ latex_documents = [
] ]
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
#intersphinx_mapping = {'http://docs.python.org/': None} #intersphinx_mapping = {'http://docs.python.org/': None}