#!/usr/bin/env python # Parse libraries and create html docs import os, sys, time, platform, subprocess if len(sys.argv)>1: print """mma-libdoc is a MMA maintenance program to parse library files and create/maintain the html library documentation. This program should be run as 'root' and it takes no command options. For more details see the file "README.mma-libdoc" which is distributed with MMA.""" sys.exit(0) installdir = ( "c:\\mma\\", "/usr/local/share/mma", "/usr/share/mma", ".") libpath = '' docpath = '' for p in installdir: a = os.path.join(p, 'lib', '') if os.path.isdir(a): libpath=a docpath = os.path.join(p, 'docs', 'html', 'lib') break if not libpath: print "Can't find the MMA library!" print "Please check your installation and/or change the search path in this program." sys.exit(1) try: os.mkdir(docpath) except: pass index = [] links = [] MMA = "mma" # set different path to mma if you need to if platform == "Windows": sh_value = True else: sh_value = False print "Processing library files" def dodir(dir): """ Process files in directory. """ global index, links newdirs = [] olib = os.path.join(docpath, dir) if not os.path.isdir(olib): try: os.mkdir(olib) except: print "Can't create directory", olib sys.exit(1) links.append("
  • %s

  • " % (dir, dir.title())) if dir.lower() == "stdlib": index.append("

    These grooves can be used from a program just by using their name.

    ") index.append("" % dir) index.append("

    %s

    " % dir.title() ) index.append("