mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Use string methods; minor code cleanup.
This commit is contained in:
parent
0cf4269862
commit
4fe904d3d6
1 changed files with 26 additions and 21 deletions
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
# Phase I: list all the things that can be imported
|
# Phase I: list all the things that can be imported
|
||||||
|
|
||||||
import glob, os, sys, string
|
import glob
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
modules = {}
|
modules = {}
|
||||||
|
|
||||||
for modname in sys.builtin_module_names:
|
for modname in sys.builtin_module_names:
|
||||||
|
@ -14,7 +17,7 @@ for dir in sys.path:
|
||||||
for file in filelist:
|
for file in filelist:
|
||||||
path, file = os.path.split(file)
|
path, file = os.path.split(file)
|
||||||
base, ext = os.path.splitext(file)
|
base, ext = os.path.splitext(file)
|
||||||
modules[string.lower(base)]=base
|
modules[base.lower()] = base
|
||||||
|
|
||||||
# Look for shared library files
|
# Look for shared library files
|
||||||
filelist = (glob.glob(os.path.join(dir, '*.so')) +
|
filelist = (glob.glob(os.path.join(dir, '*.so')) +
|
||||||
|
@ -23,12 +26,14 @@ for dir in sys.path:
|
||||||
for file in filelist:
|
for file in filelist:
|
||||||
path, file = os.path.split(file)
|
path, file = os.path.split(file)
|
||||||
base, ext = os.path.splitext(file)
|
base, ext = os.path.splitext(file)
|
||||||
if base[-6:]=='module': base=base[:-6]
|
if base[-6:] == 'module':
|
||||||
modules[string.lower(base)]=base
|
base = base[:-6]
|
||||||
|
modules[base.lower()] = base
|
||||||
|
|
||||||
# Minor oddity: the types module is documented in libtypes2.tex
|
# Minor oddity: the types module is documented in libtypes2.tex
|
||||||
if modules.has_key('types'):
|
if modules.has_key('types'):
|
||||||
del modules['types'] ; modules['types2']=None
|
del modules['types']
|
||||||
|
modules['types2'] = None
|
||||||
|
|
||||||
# Phase II: find all documentation files (lib*.tex)
|
# Phase II: find all documentation files (lib*.tex)
|
||||||
# and eliminate modules that don't have one.
|
# and eliminate modules that don't have one.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue