source: TI03-DataExtractor/branches/old_stuff/dx_source/for_usr_local/dx/scripts/createDocs.py @ 793

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI03-DataExtractor/branches/old_stuff/dx_source/for_usr_local/dx/scripts/createDocs.py@793
Revision 793, 1.4 KB checked in by astephen, 13 years ago (diff)

Put all the old code in the old_stuff branch.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3#   Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ).
4#   This software may be distributed under the terms of the
5#   Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
6
7"""
8createDocs.py
9=============
10
11Creates as much documentation as it can and puts it in the
12doc sub-directory in files corresponding to the package or
13module name.
14
15"""
16
17# Import standard library modules
18import os, sys, re, glob, commands
19sys.path.append("..")
20
21# Import local modules
22from config import BASEDIR, LOCAL_CGI_NAME
23
24# Setup global variables
25os.chdir(BASEDIR)
26pythonModules=glob.glob("*.py")
27outDir=os.path.join(BASEDIR, "doc")
28
29
30def createDocs():
31    """
32    Function to generate documentation of all python modules in
33    the main package directory.
34    """
35    for mod in pythonModules:
36        mod=mod[:-3]
37        outfile=open(os.path.join(outDir, mod+"_module.txt"), "w")
38        if mod!="config":
39            outfile.write((commands.getoutput("pydoc %s" % mod)).split("DATA\n")[0])
40        else:
41            outfile.write(commands.getoutput("pydoc %s" % mod))
42       
43        outfile.close()
44        os.system("pydoc -w %s" % mod)
45        os.system("mv -f %s.html doc/" % mod)
46        print "Written docfile for module:", mod
47       
48    print "Gzipping doc directory to dx_doc.tgz"
49    os.system("tar -cvzf dx_doc.tgz doc")
50
51
52
53if __name__=="__main__":
54
55    createDocs()
Note: See TracBrowser for help on using the repository browser.