Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 924b42d

Browse files
committed
When looking for things that might be modules, include *module.c from
the Modules/ directory. Most of the remaining undocumented modules seem to be living there.
1 parent 9e480ad commit 924b42d

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

Doc/tools/listmodules

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Limitation: Modules loadable as shared objects are not listed.
2525
__version__ = '$Revision$'
2626

2727
import getopt
28+
import glob
2829
import os
2930
import re
3031
import string
@@ -76,7 +77,6 @@ def main():
7677
srcdir = os.path.normpath(os.path.join(
7778
os.path.dirname(sys.argv[0]), os.pardir, os.pardir))
7879
os.chdir(srcdir)
79-
fp = os.popen("find Lib -name \*.py -print", "r")
8080
modules_by_name = {}
8181
modules_by_dir = {}
8282
if builtin:
@@ -87,6 +87,7 @@ def main():
8787
modules_by_name[name] = "<built-in>"
8888
l.append(name)
8989
rx = re.compile("Lib/plat-[a-z0-9]*/", re.IGNORECASE)
90+
fp = os.popen("find Lib -name \*.py -print", "r")
9091
while 1:
9192
line = fp.readline()
9293
if not line:
@@ -105,6 +106,22 @@ def main():
105106
modules_by_dir[dir] = l
106107
if name not in l:
107108
l.append(name)
109+
# load up extension modules:
110+
pwd = os.getcwd()
111+
try:
112+
os.chdir("Modules")
113+
dir = "<extension>"
114+
for line in glob.glob("*module.c"):
115+
name = line[:-8]
116+
if ignore(name) or modules_by_name.has_key(name) or name == "xx":
117+
continue
118+
modules_by_name[name] = dir
119+
l = modules_by_dir.get(dir, [])
120+
modules_by_dir[dir] = l
121+
if name not in l:
122+
l.append(name)
123+
finally:
124+
os.chdir(pwd)
108125
#
109126
# Dump the results:
110127
#

0 commit comments

Comments
 (0)