Generate task graph data through sphinx conf.py

This commit is contained in:
Anders Ingemann 2015-04-11 16:28:22 +02:00
parent fc29266c97
commit c089301f79
6 changed files with 16 additions and 9 deletions

0
docs/__init__.py Normal file
View file

1
docs/_static/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
graph.json

File diff suppressed because one or more lines are too long

View file

@ -14,8 +14,6 @@
import sys
import os
import glob
import os.path
# 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
@ -267,6 +265,9 @@ texinfo_documents = [('index', 'bootstrap-vz', u'bootstrap-vz Documentation',
# -- Link to rst files scattered throughout the project -------------------
import glob
import os.path
for readme_path in glob.glob('../bootstrapvz/providers/*/README.rst'):
provider_name = os.path.basename(os.path.dirname(readme_path))
include_path = os.path.join('providers', provider_name + '.rst')
@ -281,3 +282,11 @@ for readme_path in glob.glob('../bootstrapvz/plugins/*/README.rst'):
path_to_readme = os.path.join('../../bootstrapvz/plugins', plugin_name, 'README.rst')
with open(include_path, 'w') as include:
include.write('.. include:: ' + path_to_readme)
# -- Create task overview graph data --------------------------------------
from docs import taskoverview
data = taskoverview.generate_graph_data()
taskoverview.write_data(data, '_static/graph.json')

View file

@ -5,7 +5,7 @@ import os.path
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
def main(opts):
def generate_graph_data():
from bootstrapvz.base.tasklist import get_all_tasks
tasks = get_all_tasks()
@ -49,13 +49,11 @@ def main(opts):
link[key] = tasks.index(link[key])
return link
data = {'phases': map(mk_phase, phases.order),
return {'phases': map(mk_phase, phases.order),
'modules': map(mk_module, modules),
'nodes': map(mk_node, tasks),
'links': map(mk_link, task_links)}
write_data(data, opts.get('--output', None))
def write_data(data, output_path=None):
import json
@ -77,4 +75,5 @@ if __name__ == '__main__' and __package__ is None:
"""
opts = docopt(usage)
main(opts)
data = generate_graph_data()
write_data(data, opts.get('--output', None))

View file

@ -20,7 +20,6 @@ changedir = docs
deps =
sphinx
commands =
./taskoverview.py --output _static/graph.json
sphinx-build -W -b html -d _build/html/doctrees . _build/html
[testenv:docs-serve]