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:: %(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=[ ('aboutbox', 'aboutbox'), ('config', 'config'), ('data_loader', 'data_loader'), ('dataFitting', 'dataFitting'), ('dummyapp', 'dummyapp'), ('gui_manager', 'gui_manager'), ('load_thread', 'load_thread'), ('statusbar', 'statusbar'), ('utils', 'utils'), ('version', 'version'), ] package = 'sans.guiframe' package_name='Reference' if __name__ == "__main__": genfiles(package, package_name, modules, dir='api') modules=[ ('AnnulusSlicer', 'AnnulusSlicer'), ('Arc', 'Arc'), ('AzimutSlicer', 'AzimutSlicer'), ('BaseInteractor', 'BaseInteractor'), ('binder', 'binder'), ('boxMask', 'boxMask'), ('boxSlicer', 'boxSlicer'), ('boxSum', 'boxSum'), ('detector_dialog', 'detector_dialog'), ('Edge', 'Edge'), ('masking', 'masking'), ('Plotter1D', 'Plotter1D'), ('Plotter2D', 'Plotter2D'), ('plotting', 'plotting'), ('sectorMask', 'sectorMask'), ('SectorSlicer', 'SectorSlicer'), ('slicerpanel', 'slicerpanel'), ('SlicerParameters', 'SlicerParameters'), ] package = 'sans.guiframe.local_perspectives.plotting' package_name = 'Local Perspective: Plotting' genfiles(package, package_name, modules, dir='api/local_perspectives/plotting') print "Sphinx: generate .rst files complete..."