1 # Generate custlib.tex, which is a site-specific library document.
3 # Phase I: list all the things that can be imported
11 for modname
in sys
.builtin_module_names
:
12 modules
[modname
] = modname
16 filelist
= glob
.glob(os
.path
.join(dir, '*.py'))
18 path
, file = os
.path
.split(file)
19 base
, ext
= os
.path
.splitext(file)
20 modules
[base
.lower()] = base
22 # Look for shared library files
23 filelist
= (glob
.glob(os
.path
.join(dir, '*.so')) +
24 glob
.glob(os
.path
.join(dir, '*.sl')) +
25 glob
.glob(os
.path
.join(dir, '*.o')) )
27 path
, file = os
.path
.split(file)
28 base
, ext
= os
.path
.splitext(file)
29 if base
[-6:] == 'module':
31 modules
[base
.lower()] = base
33 # Minor oddity: the types module is documented in libtypes2.tex
34 if modules
.has_key('types'):
36 modules
['types2'] = None
38 # Phase II: find all documentation files (lib*.tex)
39 # and eliminate modules that don't have one.
42 filelist
= glob
.glob('lib*.tex')
45 docs
[modname
] = modname
47 mlist
= modules
.keys()
48 mlist
= filter(lambda x
, docs
=docs
: docs
.has_key(x
), mlist
)
50 mlist
= map(lambda x
, docs
=docs
: docs
[x
], mlist
)
54 # Phase III: write custlib.tex
56 # Write the boilerplate
57 # XXX should be fancied up.
58 print """\documentstyle[twoside,11pt,myformat]{report}
59 \\title{Python Library Reference}
61 \\makeindex % tell \\index to actually write the .idx file
63 \\pagenumbering{roman}
67 \\noindent This is a customized version of the Python Library Reference.
70 {\\parskip = 0mm \\tableofcontents}
71 \\pagebreak\\pagenumbering{arabic}"""
74 print "\\input{lib%s}" % (modname
,)
77 print """\\input{custlib.ind} % Index