1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-18 20:11:20 +00:00

Documentation: Modified conf.py to allow building on ReadTheDocs

This commit now automatically calls the extension and
instrumentation documention generator and calls Sphinx-api tool
to allow documention generation on ReadTheDocs.
This commit is contained in:
Marc Bonnici 2017-08-14 16:07:30 +01:00
parent 4c0d3f8d20
commit cdd0834447

View File

@ -28,12 +28,16 @@
import sys, os
import warnings
from sphinx.apidoc import main
warnings.filterwarnings('ignore', "Module louie was already imported")
this_dir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(this_dir, '..'))
sys.path.insert(0, os.path.join(this_dir, '../..'))
import wlauto
from build_extension_docs import generate_extension_documentation
from build_instrumentation_method_map import generate_instrumentation_method_map
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -264,7 +268,21 @@ texinfo_documents = [
#texinfo_show_urls = 'footnote'
def run_apidoc(_):
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
cur_dir = os.path.abspath(os.path.dirname(__file__))
api_output = os.path.join(cur_dir, 'api')
module = os.path.join(cur_dir, '..', '..', 'wlauto')
main(['-f', '-o', api_output, module, '--force'])
def setup(app):
module_dir = os.path.join('..', '..', 'wlauto')
excluded_extensions = [os.path.join(module_dir, 'external'),
os.path.join(module_dir, 'tests')]
os.chdir(os.path.dirname(__file__))
app.connect('builder-inited', run_apidoc)
generate_instrumentation_method_map('instrumentation_method_map.rst')
generate_extension_documentation(module_dir, 'extensions', excluded_extensions)
app.add_object_type('confval', 'confval',
objname='configuration value',
indextemplate='pair: %s; configuration value')