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
This commit is contained in:
Davanum Srinivas 2014-09-03 20:58:59 -04:00
parent 70dcb60796
commit 17b33061b2
4 changed files with 35 additions and 2 deletions

View File

@ -14,6 +14,8 @@
import os import os
import sys import sys
import fileinput
import fnmatch
sys.path.insert(0, os.path.abspath('../..')) sys.path.insert(0, os.path.abspath('../..'))
# -- General configuration ---------------------------------------------------- # -- General configuration ----------------------------------------------------
@ -30,6 +32,23 @@ extensions = [
# text edit cycles. # text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable # 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. # The suffix of source filenames.
source_suffix = '.rst' source_suffix = '.rst'

View File

@ -16,6 +16,14 @@ Contents:
usage usage
contributing contributing
Code Documentation
==================
.. toctree::
:maxdepth: 1
api/autoindex
Indices and tables Indices and tables
================== ==================

View File

@ -46,4 +46,10 @@ input_file = oslo.concurrency/locale/oslo.concurrency.pot
[extract_messages] [extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg mapping_file = babel.cfg
output_file = oslo.concurrency/locale/oslo.concurrency.pot output_file = oslo.concurrency/locale/oslo.concurrency.pot
[pbr]
# NOTE(dims): uncomment ``warnerrors`` line, when
# want to treat sphinx warnings as errors
# warnerrors = True
autodoc_index_modules = True

View File

@ -2,5 +2,5 @@ hacking>=0.9.1,<0.10
oslotest oslotest
# These are needed for docs generation # These are needed for docs generation
oslosphinx oslosphinx>=2.2.0.0a2
sphinx>=1.1.2,!=1.2.0,<1.3 sphinx>=1.1.2,!=1.2.0,<1.3