1
# Generate custlib.tex, which is a site-specific library document.
3
# Phase I: list all the things that can be imported
5
import glob, os, sys, string
8
for modname in sys.builtin_module_names:
9
modules[modname]=modname
13
filelist=glob.glob(os.path.join(dir, '*.py'))
15
path, file = os.path.split(file)
16
base, ext=os.path.splitext(file)
17
modules[string.lower(base)]=base
19
# Look for shared library files
20
filelist=(glob.glob(os.path.join(dir, '*.so')) +
21
glob.glob(os.path.join(dir, '*.sl')) +
22
glob.glob(os.path.join(dir, '*.o')) )
24
path, file = os.path.split(file)
25
base, ext=os.path.splitext(file)
26
if base[-6:]=='module': base=base[:-6]
27
modules[string.lower(base)]=base
29
# Minor oddity: the types module is documented in libtypes2.tex
30
if modules.has_key('types'):
31
del modules['types'] ; modules['types2']=None
33
# Phase II: find all documentation files (lib*.tex)
34
# and eliminate modules that don't have one.
37
filelist=glob.glob('lib*.tex')
43
mlist=filter(lambda x, docs=docs: docs.has_key(x), mlist)
45
mlist=map(lambda x, docs=docs: docs[x], mlist)
49
# Phase III: write custlib.tex
51
# Write the boilerplate
52
# XXX should be fancied up.
53
print """\documentstyle[twoside,11pt,myformat]{report}
54
\\title{Python Library Reference}
56
\\makeindex % tell \\index to actually write the .idx file
58
\\pagenumbering{roman}
62
\\noindent This is a customized version of the Python Library Reference.
65
{\\parskip = 0mm \\tableofcontents}
66
\\pagebreak\\pagenumbering{arabic}"""
69
print "\\input{lib%s}" % (modname,)
72
print """\\input{custlib.ind} % Index