Merge "doc: use pbr to auto-generate doc"
This commit is contained in:
commit
182c50d895
|
@ -54,4 +54,4 @@ ChangeLog
|
|||
.*sw?
|
||||
|
||||
# generated docs
|
||||
doc/source/ref/
|
||||
doc/source/api
|
||||
|
|
|
@ -21,7 +21,7 @@ Reference
|
|||
For more information, see the reference:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:maxdepth: 2
|
||||
|
||||
ref/v1/index
|
||||
api/autoindex
|
||||
|
||||
|
|
|
@ -21,43 +21,6 @@ ROOT = os.path.abspath(os.path.join(BASE_DIR, "..", ".."))
|
|||
sys.path.insert(0, ROOT)
|
||||
sys.path.insert(0, BASE_DIR)
|
||||
|
||||
|
||||
def gen_ref(ver, title, names):
|
||||
refdir = os.path.join(BASE_DIR, "ref")
|
||||
pkg = "gnocchiclient"
|
||||
if ver:
|
||||
pkg = "%s.%s" % (pkg, ver)
|
||||
refdir = os.path.join(refdir, ver)
|
||||
if not os.path.exists(refdir):
|
||||
os.makedirs(refdir)
|
||||
idxpath = os.path.join(refdir, "index.rst")
|
||||
with open(idxpath, "w") as idx:
|
||||
idx.write(("%(title)s\n"
|
||||
"%(signs)s\n"
|
||||
"\n"
|
||||
".. toctree::\n"
|
||||
" :maxdepth: 1\n"
|
||||
"\n") % {"title": title, "signs": "=" * len(title)})
|
||||
for name in names:
|
||||
idx.write(" %s\n" % name)
|
||||
rstpath = os.path.join(refdir, "%s.rst" % name)
|
||||
with open(rstpath, "w") as rst:
|
||||
rst.write(("%(title)s\n"
|
||||
"%(signs)s\n"
|
||||
"\n"
|
||||
".. automodule:: %(pkg)s.%(name)s\n"
|
||||
" :members:\n"
|
||||
" :undoc-members:\n"
|
||||
" :show-inheritance:\n"
|
||||
" :noindex:\n")
|
||||
% {"title": " ".join([n.capitalize()
|
||||
for n in name.split("_")]),
|
||||
"signs": "=" * len(name),
|
||||
"pkg": pkg, "name": name})
|
||||
|
||||
gen_ref("v1", "Version 1 API", ["client", "resource", "archive_policy",
|
||||
"archive_policy_rule", "metric"])
|
||||
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
|
@ -98,7 +61,7 @@ pygments_style = 'sphinx'
|
|||
# html_theme_path = ["."]
|
||||
# html_theme = '_theme'
|
||||
# html_static_path = ['static']
|
||||
html_theme = 'openstack'
|
||||
html_theme = os.getenv("SPHINX_HTML_THEME", 'openstack')
|
||||
|
||||
if html_theme == "sphinx_rtd_theme":
|
||||
import sphinx_rtd_theme
|
||||
|
|
|
@ -51,5 +51,10 @@ all_files = 1
|
|||
[upload_sphinx]
|
||||
upload-dir = doc/build/html
|
||||
|
||||
[pbr]
|
||||
autodoc_index_modules = true
|
||||
autodoc_exclude_modules =
|
||||
gnocchiclient.tests.*
|
||||
|
||||
[wheel]
|
||||
universal = 1
|
||||
|
|
9
tox.ini
9
tox.ini
|
@ -17,22 +17,23 @@ deps = hacking<0.11,>=0.10.0
|
|||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
deps = .[doc]
|
||||
deps = .[test,doc]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py test --coverage --testr-args='{posargs}'
|
||||
|
||||
[testenv:docs]
|
||||
deps = .[doc]
|
||||
deps = .[test,doc]
|
||||
commands =
|
||||
rm -rf doc/source/ref
|
||||
python setup.py build_sphinx
|
||||
|
||||
[testenv:docs-gnocchi.xyz]
|
||||
deps = .[doc]
|
||||
deps = .[test,doc]
|
||||
sphinx_rtd_theme
|
||||
commands = sphinx-build -D html_theme=sphinx_rtd_theme doc/source doc/build/html
|
||||
setenv = SPHINX_HTML_THEME=sphinx_rtd_theme
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
commands = {toxinidir}/setup-tests.sh oslo_debug_helper {posargs}
|
||||
|
|
Loading…
Reference in New Issue