From 73d116001bccd243fc3394c189028447ee16e514 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Sun, 21 Sep 2014 18:13:37 -0400 Subject: [PATCH] Fixup autoindex.rst only if it exists Closes-Bug: #1370370 Change-Id: I05638808b577db8e96e5b83aa8b5a9c47f8170c1 --- doc/source/conf.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index af84084..90faf0b 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -39,13 +39,15 @@ exclude_patterns = [ ] # Prune the excluded patterns from the autoindex -for line in fileinput.input('api/autoindex.rst', inplace=True): - found = False - for pattern in exclude_patterns: - if fnmatch.fnmatch(line, '*' + pattern[4:]): - found = True - if not found: - print line, +PATH = 'api/autoindex.rst' +if os.path.isfile(PATH) and os.access(PATH, os.R_OK): + for line in fileinput.input(PATH, inplace=True): + found = False + for pattern in exclude_patterns: + if fnmatch.fnmatch(line, '*' + pattern[4:]): + found = True + if not found: + print line, # The suffix of source filenames. source_suffix = '.rst' @@ -89,4 +91,4 @@ latex_documents = [ ] # Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} \ No newline at end of file +#intersphinx_mapping = {'http://docs.python.org/': None}