Skip to content
Snippets Groups Projects
Commit dae00fec authored by Todd Gamblin's avatar Todd Gamblin
Browse files

Move all documentation generation into conf.py

- extra steps in Makefile are ignored by readthedocs
parent 47bf7ecb
No related branches found
No related tags found
No related merge requests found
......@@ -21,24 +21,6 @@ I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
all: html
#
# This autogenerates a package list.
#
package_list:
spack package-list > package_list.rst
#
# Generate a command index
#
command_index:
cp command_index.in command_index.rst
echo >> command_index.rst
grep -ho '.. _spack-.*:' *rst \
| perl -pe 's/.. _([^:]*):/ * :ref:`\1`/' \
| sort >> command_index.rst
custom_targets: package_list command_index
#
# This creates a git repository and commits generated html docs.
# It them pushes the new branch into THIS repository as gh-pages.
......@@ -92,7 +74,7 @@ clean:
-rm -f package_list.rst command_index.rst
-rm -rf $(BUILDDIR)/* $(APIDOC_FILES)
html: apidoc custom_targets
html: apidoc
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
......
......@@ -779,7 +779,7 @@ use the triplet form of platform, operating system and processor.
Users on non-Cray systems won't have to worry about specifying the architecture.
Spack will autodetect what kind of operating system is on your machine as well
as the processor. For more information on how the architecture can be
used on Cray machines, check here :ref:`spack-cray`
used on Cray machines, check here :ref:`cray-support`
.. _sec-virtual-dependencies:
......@@ -1798,7 +1798,7 @@ This issue typically manifests with the error below:
A nicer error message is TBD in future versions of Spack.
.. _spack-cray:
.. _cray-support:
Spack on Cray
-----------------------------
......
......@@ -37,7 +37,10 @@
import sys
import os
import re
import shutil
import subprocess
from glob import glob
# 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
......@@ -50,10 +53,36 @@
os.environ['SPACK_ROOT'] = spack_root
os.environ['PATH'] += os.pathsep + '$SPACK_ROOT/bin'
# Get the spack version for use in the docs
spack_version = subprocess.Popen(
[spack_root + '/bin/spack', '-V'],
stderr=subprocess.PIPE).communicate()[1].strip().split('.')
#
# Generate package list using spack command
#
with open('package_list.rst', 'w') as plist_file:
subprocess.Popen(
[spack_root + '/bin/spack', 'package-list'], stdout=plist_file)
#
# Find all the `spack-*` references and add them to a command index
#
command_names = []
for filename in glob('*rst'):
with open(filename) as f:
for line in f:
match = re.match(r'.. _(spack-[^:]*)', line)
if match:
command_names.append(match.group(1).strip())
shutil.copy('command_index.in', 'command_index.rst')
with open('command_index.rst', 'a') as index:
index.write('\n')
for cmd in command_names:
index.write(' * :ref:`%s`\n' % cmd)
# Set an environment variable so that colify will print output like it would to
# a terminal.
os.environ['COLIFY_SIZE'] = '25x80'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment