[Python-checkins] python/dist/src/Doc/tools custlib.py,1.2,1.3
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Wed, 16 Oct 2002 07:59:05 -0700
- Previous message: [Python-checkins] distutils/distutils/command bdist_wininst.py,1.36,1.37
- Next message: [Python-checkins] python/dist/src/Doc/tools buildindex.py,1.12,1.13 indfix.py,1.5,1.6 keywords.py,1.2,1.3 refcounts.py,1.3,1.4 rewrite.py,1.1,1.2 toc2bkm.py,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv14544
Modified Files:
custlib.py
Log Message:
Use string methods; minor code cleanup.
Index: custlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/custlib.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** custlib.py 7 Oct 2000 12:50:05 -0000 1.2
--- custlib.py 16 Oct 2002 14:59:02 -0000 1.3
***************
*** 3,49 ****
# Phase I: list all the things that can be imported
! import glob, os, sys, string
! modules={}
for modname in sys.builtin_module_names:
! modules[modname]=modname
for dir in sys.path:
# Look for *.py files
! filelist=glob.glob(os.path.join(dir, '*.py'))
for file in filelist:
path, file = os.path.split(file)
! base, ext=os.path.splitext(file)
! modules[string.lower(base)]=base
# Look for shared library files
! filelist=(glob.glob(os.path.join(dir, '*.so')) +
! glob.glob(os.path.join(dir, '*.sl')) +
! glob.glob(os.path.join(dir, '*.o')) )
for file in filelist:
path, file = os.path.split(file)
! base, ext=os.path.splitext(file)
! if base[-6:]=='module': base=base[:-6]
! modules[string.lower(base)]=base
# Minor oddity: the types module is documented in libtypes2.tex
if modules.has_key('types'):
! del modules['types'] ; modules['types2']=None
# Phase II: find all documentation files (lib*.tex)
# and eliminate modules that don't have one.
! docs={}
! filelist=glob.glob('lib*.tex')
for file in filelist:
! modname=file[3:-4]
! docs[modname]=modname
! mlist=modules.keys()
! mlist=filter(lambda x, docs=docs: docs.has_key(x), mlist)
mlist.sort()
! mlist=map(lambda x, docs=docs: docs[x], mlist)
! modules=mlist
# Phase III: write custlib.tex
--- 3,54 ----
# Phase I: list all the things that can be imported
! import glob
! import os.path
! import sys
!
! modules = {}
for modname in sys.builtin_module_names:
! modules[modname] = modname
for dir in sys.path:
# Look for *.py files
! filelist = glob.glob(os.path.join(dir, '*.py'))
for file in filelist:
path, file = os.path.split(file)
! base, ext = os.path.splitext(file)
! modules[base.lower()] = base
# Look for shared library files
! filelist = (glob.glob(os.path.join(dir, '*.so')) +
! glob.glob(os.path.join(dir, '*.sl')) +
! glob.glob(os.path.join(dir, '*.o')) )
for file in filelist:
path, file = os.path.split(file)
! base, ext = os.path.splitext(file)
! if base[-6:] == 'module':
! base = base[:-6]
! modules[base.lower()] = base
# Minor oddity: the types module is documented in libtypes2.tex
if modules.has_key('types'):
! del modules['types']
! modules['types2'] = None
# Phase II: find all documentation files (lib*.tex)
# and eliminate modules that don't have one.
! docs = {}
! filelist = glob.glob('lib*.tex')
for file in filelist:
! modname = file[3:-4]
! docs[modname] = modname
! mlist = modules.keys()
! mlist = filter(lambda x, docs=docs: docs.has_key(x), mlist)
mlist.sort()
! mlist = map(lambda x, docs=docs: docs[x], mlist)
! modules = mlist
# Phase III: write custlib.tex
- Previous message: [Python-checkins] distutils/distutils/command bdist_wininst.py,1.36,1.37
- Next message: [Python-checkins] python/dist/src/Doc/tools buildindex.py,1.12,1.13 indfix.py,1.5,1.6 keywords.py,1.2,1.3 refcounts.py,1.3,1.4 rewrite.py,1.1,1.2 toc2bkm.py,1.10,1.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]