From 17b33061b22b6558a2aa666fdcae6534bc2b1c79 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Wed, 3 Sep 2014 20:58:59 -0400 Subject: Add code/api documentation Once we use the pbr based build to generate files, we prune the indexes to remove references to code we would like to hide like the common modules and private modules in conf.py. We reuse the same excluded_patterns variable that is already used in Sphinx and filter these modules from autoindex.rst Change-Id: I4baea1efa227ef14bc6706d59ff3dcad93c2eacc Closes-Bug: #1364140 --- doc/source/conf.py | 19 +++++++++++++++++++ doc/source/index.rst | 8 ++++++++ 2 files changed, 27 insertions(+) (limited to 'doc') diff --git a/doc/source/conf.py b/doc/source/conf.py index ad9161d..4f69dc1 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -14,6 +14,8 @@ import os import sys +import fileinput +import fnmatch sys.path.insert(0, os.path.abspath('../..')) # -- General configuration ---------------------------------------------------- @@ -30,6 +32,23 @@ extensions = [ # text edit cycles. # execute "export SPHINX_DEBUG=1" in your terminal to disable +# A list of glob-style patterns that should be excluded when looking for source +# files. +exclude_patterns = [ + 'api/tests.*', # avoid of docs generation from tests + 'api/oslo.concurrency.openstack.common.*', # skip common modules + 'api/oslo.concurrency._*', # skip private modules +] + +# 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, + # The suffix of source filenames. source_suffix = '.rst' diff --git a/doc/source/index.rst b/doc/source/index.rst index 8ed8add..dc4f6f2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -16,6 +16,14 @@ Contents: usage contributing +Code Documentation +================== + +.. toctree:: + :maxdepth: 1 + + api/autoindex + Indices and tables ================== -- cgit v1.2.1