def run_apidoc(_): cur_dir = Path(__file__).parent.resolve() module_path = cur_dir.parent / "easygv" cmd_opts = "-M -f -o {cur_dir} {module_path} -H 'Source Code Documentation'" opt_list = shlex.split(cmd_opts.format(cur_dir=str(cur_dir), module_path=str(module_path))) sphinx_apidoc(opt_list)
index.write(' * :ref:`%s`\n' % cmd) # # Run sphinx-apidoc # # Remove any previous API docs # Read the Docs doesn't clean up after previous builds # Without this, the API Docs will never actually update # apidoc_args = [ '--force', # Older versions of Sphinx ignore the first argument '--force', # Overwrite existing files '--no-toc', # Don't create a table of contents file '--output-dir=.', # Directory to place all output ] sphinx_apidoc(apidoc_args + ['../spack']) sphinx_apidoc(apidoc_args + ['../llnl']) # # Exclude everything in spack.__all__ from indexing. All of these # symbols are imported from elsewhere in spack; their inclusion in # __all__ simply allows package authors to use `from spack import *`. # Excluding them ensures they're only documented in their "real" module. # # This also avoids issues where some of these symbols shadow core spack # modules. Sphinx will complain about duplicate docs when this happens. # import fileinput, spack handling_spack = False for line in fileinput.input('spack.rst', inplace=1): if handling_spack:
for filename in glob('*rst'): with open(filename) as f: for line in f: match = re.match('.. _(cmd-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 sorted(command_names): index.write(' * :ref:`%s`\n' % cmd) # Run sphinx-apidoc sphinx_apidoc(['-T', '-o', '.', '../spack']) os.remove('modules.rst') # # Exclude everything in spack.__all__ from indexing. All of these # symbols are imported from elsewhere in spack; their inclusion in # __all__ simply allows package authors to use `from spack import *`. # Excluding them ensures they're only documented in their "real" module. # # This also avoids issues where some of these symbols shadow core spack # modules. Sphinx will complain about duplicate docs when this happens. # import fileinput, spack handling_spack = False for line in fileinput.input('spack.rst', inplace=1): if handling_spack: