diff options
-rw-r--r-- | lib/spack/docs/.gitignore | 1 | ||||
-rw-r--r-- | lib/spack/docs/Makefile | 2 | ||||
-rw-r--r-- | lib/spack/docs/conf.py | 22 |
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/spack/docs/.gitignore b/lib/spack/docs/.gitignore index 26c343d3eb..0bbf78cce0 100644 --- a/lib/spack/docs/.gitignore +++ b/lib/spack/docs/.gitignore @@ -1,4 +1,5 @@ package_list.rst command_index.rst spack*.rst +modules.rst _build diff --git a/lib/spack/docs/Makefile b/lib/spack/docs/Makefile index 302ffd4c97..f9eae29187 100644 --- a/lib/spack/docs/Makefile +++ b/lib/spack/docs/Makefile @@ -74,7 +74,7 @@ clean: -rm -f package_list.rst command_index.rst -rm -rf $(BUILDDIR)/* $(APIDOC_FILES) -html: apidoc +html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 95549e3b1e..c0dccaa6ba 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -42,13 +42,16 @@ import re import shutil import subprocess from glob import glob +from sphinx.apidoc import main as sphinx_apidoc + +# -- Spack customizations ----------------------------------------------------- # 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 # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('exts')) sys.path.insert(0, os.path.abspath('../external')) -sys.path.append(os.path.abspath('../spack')) +sys.path.append(os.path.abspath('..')) # Add the Spack bin directory to the path so that we can use its output in docs. spack_root = '../../..' @@ -60,10 +63,17 @@ spack_version = subprocess.Popen( [spack_root + '/bin/spack', '-V'], stderr=subprocess.PIPE).communicate()[1].strip().split('.') +# Set an environment variable so that colify will print output like it would to +# a terminal. +os.environ['COLIFY_SIZE'] = '25x80' + # # Generate package list using spack command # with open('package_list.rst', 'w') as plist_file: + subprocess.check_output( + [spack_root + '/bin/spack', 'package-list']) + subprocess.Popen( [spack_root + '/bin/spack', 'package-list'], stdout=plist_file) @@ -81,9 +91,13 @@ for filename in glob('*rst'): shutil.copy('command_index.in', 'command_index.rst') with open('command_index.rst', 'a') as index: index.write('\n') - for cmd in command_names: + for cmd in sorted(command_names): index.write(' * :ref:`%s`\n' % cmd) + +# Run sphinx-apidoc +sphinx_apidoc(['-T', '-o', '.', '../spack']) + # # Exclude everything in spack.__all__ from indexing. All of these # symbols are imported from elsewhere in spack; their inclusion in @@ -106,10 +120,6 @@ for line in fileinput.input('spack.rst', inplace=1): print line, -# Set an environment variable so that colify will print output like it would to -# a terminal. -os.environ['COLIFY_SIZE'] = '25x80' - # Enable todo items todo_include_todos = True |