Update doc/source/conf.py
* Exclude test files from source code index * Add an index to jump to sub indexes in source code index * Ensure the order of source code index by using an array rather than a dict. Change-Id: I5c28a3e29c9c0b0332732d3f598030a77536563a
This commit is contained in:
parent
9a5bb3e070
commit
a25091e89f
@ -47,6 +47,8 @@ def write_autodoc_index():
|
|||||||
print("SEARCHING %s" % sourcedir)
|
print("SEARCHING %s" % sourcedir)
|
||||||
for root, dirs, files in os.walk("."):
|
for root, dirs, files in os.walk("."):
|
||||||
for filename in files:
|
for filename in files:
|
||||||
|
if filename == 'tests.py':
|
||||||
|
continue
|
||||||
if filename.endswith(".py"):
|
if filename.endswith(".py"):
|
||||||
# remove the pieces of the root
|
# remove the pieces of the root
|
||||||
elements = root.split(os.path.sep)
|
elements = root.split(os.path.sep)
|
||||||
@ -62,10 +64,14 @@ def write_autodoc_index():
|
|||||||
return modlist
|
return modlist
|
||||||
|
|
||||||
RSTDIR = os.path.abspath(os.path.join(BASE_DIR, "sourcecode"))
|
RSTDIR = os.path.abspath(os.path.join(BASE_DIR, "sourcecode"))
|
||||||
SRCS = {'horizon': ROOT,
|
SRCS = [('horizon', ROOT),
|
||||||
'openstack_dashboard': ROOT}
|
('openstack_dashboard', ROOT)]
|
||||||
|
|
||||||
EXCLUDED_MODULES = ('horizon.tests', 'openstack_dashboard.tests',)
|
EXCLUDED_MODULES = ('horizon.test',
|
||||||
|
'openstack_dashboard.enabled',
|
||||||
|
'openstack_dashboard.test',
|
||||||
|
'openstack_dashboard.openstack.common',
|
||||||
|
)
|
||||||
CURRENT_SOURCES = {}
|
CURRENT_SOURCES = {}
|
||||||
|
|
||||||
if not(os.path.exists(RSTDIR)):
|
if not(os.path.exists(RSTDIR)):
|
||||||
@ -73,11 +79,18 @@ def write_autodoc_index():
|
|||||||
CURRENT_SOURCES[RSTDIR] = ['autoindex.rst']
|
CURRENT_SOURCES[RSTDIR] = ['autoindex.rst']
|
||||||
|
|
||||||
INDEXOUT = open(os.path.join(RSTDIR, "autoindex.rst"), "w")
|
INDEXOUT = open(os.path.join(RSTDIR, "autoindex.rst"), "w")
|
||||||
INDEXOUT.write("=================\n")
|
INDEXOUT.write("""
|
||||||
INDEXOUT.write("Source Code Index\n")
|
=================
|
||||||
INDEXOUT.write("=================\n")
|
Source Code Index
|
||||||
|
=================
|
||||||
|
|
||||||
for modulename, path in SRCS.items():
|
.. contents::
|
||||||
|
:depth: 1
|
||||||
|
:local:
|
||||||
|
|
||||||
|
""")
|
||||||
|
|
||||||
|
for modulename, path in SRCS:
|
||||||
sys.stdout.write("Generating source documentation for %s\n" %
|
sys.stdout.write("Generating source documentation for %s\n" %
|
||||||
modulename)
|
modulename)
|
||||||
INDEXOUT.write("\n%s\n" % modulename.capitalize())
|
INDEXOUT.write("\n%s\n" % modulename.capitalize())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user