1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
from __future__ import with_statement
import os.path
MODULE_TEMPLATE = """.. Autogenerated by genmods.py
******************************************************************************
%(name)s
******************************************************************************
:mod:`%(package)s.%(module)s`
==============================================================================
.. automodule:: %(package)s.%(module)s
:members:
:undoc-members:
:inherited-members:
:show-inheritance:
"""
INDEX_TEMPLATE = """.. Autogenerated by genmods.py
.. _api-index:
##############################################################################
%(package_name)s
##############################################################################
.. only:: html
:Release: |version|
:Date: |today|
.. toctree::
:titlesonly:
:numbered: 1
:maxdepth: 2
%(rsts)s
"""
def genfiles(package, package_name, modules, dir='api'):
if not os.path.exists(dir):
os.makedirs(dir)
for module, name in modules:
with open(os.path.join(dir, module+'.rst'), 'w') as f:
f.write(MODULE_TEMPLATE%locals())
rsts = "\n ".join(module+'.rst' for module, name in modules)
with open(os.path.join(dir, 'index.rst'), 'w') as f:
f.write(INDEX_TEMPLATE%locals())
modules = [
('__init__', 'Sasmodels package'),
#('alignment', 'GPU data alignment [unused]'),
('bumps_model', 'Bumps interface'),
('compare', 'Compare models on different compute engines'),
('compare_many', 'Batch compare models on different compute engines'),
('conversion_table', 'Model conversion table'),
('convert', 'Sasview to sasmodel converter'),
('custom.__init__', 'Load custom kernel modules'),
('core', 'Model access'),
('data', 'Data layout and plotting routines'),
('details', 'Parameter packing for kernel calls'),
('direct_model', 'Simple interface'),
('exception', 'Annotate exceptions'),
('generate', 'Model parser'),
('gengauss', 'Generate Gauss-Legendre integration points'),
('guyou', 'Guyou map projection'),
('jitter', 'Orientation explorer'),
('kernel', 'Evaluator type definitions'),
('kernelcl', 'OpenCL model evaluator'),
('kernelcuda', 'CUDA model evaluator'),
('kerneldll', 'Ctypes model evaluator'),
('kernelpy', 'Python model evaluator'),
('list_pars', 'Identify all parameters in all models'),
('mixture', 'Mixture model evaluator'),
# Docs for models are generated by Makefile + genmodel.py, and don't
# need to be managed by autodoc.
#('models.__init__', 'Builtin models'),
('model_test', 'Unit test support'),
('modelinfo', 'Parameter and model definitions'),
('multiscat', 'Multiple scattering support'),
('product', 'Product model evaluator'),
('resolution', '1-D resolution functions'),
('resolution2d', '2-D resolution functions'),
('rst2html', 'Convert doc strings the web pages'),
('sasview_model', 'Sasview interface'),
('sesans', 'SESANS calculation routines'),
('special', 'Special functions library'),
('weights', 'Distribution functions'),
]
package = 'sasmodels'
package_name = 'Reference'
genfiles(package, package_name, modules)
|