summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2001-11-29 04:30:46 (GMT)
committerFred Drake <fdrake@acm.org>2001-11-29 04:30:46 (GMT)
commitea4d2c0241f3f32a7ff0fdc0b1b5c8e4bb58e445 (patch)
tree328feb87615e75721b056a929977ca89e74c9bc7 /Doc
parentcffed4bc2162e453a8458d3014e23fa07b627aff (diff)
downloadcpython-ea4d2c0241f3f32a7ff0fdc0b1b5c8e4bb58e445.zip
cpython-ea4d2c0241f3f32a7ff0fdc0b1b5c8e4bb58e445.tar.gz
cpython-ea4d2c0241f3f32a7ff0fdc0b1b5c8e4bb58e445.tar.bz2
A few small changes:
- Change PREFIX to PREFIXES, which contains a sequence of prefix strings. This is useful since we want to look for both Py and PY. - Wrap a long line. - Collect struct tags as well as typedef names. Since we generally only use one of the other, that improves coverage. - Make the script executable on Unix. This could use a better approach to determine if a symbol is documented, and could easily avoid keeping the massive string in memory. That would take time to actually write more code, though, so we'll bail on that for now.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tools/undoc_symbols.py25
1 files changed, 17 insertions, 8 deletions
diff --git a/Doc/tools/undoc_symbols.py b/Doc/tools/undoc_symbols.py
index 541984f..d7a9e5d 100644
--- a/Doc/tools/undoc_symbols.py
+++ b/Doc/tools/undoc_symbols.py
@@ -1,4 +1,7 @@
-"""This script prints out a list of undocumented symbols found in
+#! /usr/bin/env python
+
+"""\
+This script prints out a list of undocumented symbols found in
Python include files, prefixed by their tag kind.
Pass Python's include files to ctags, parse the output into a
@@ -11,14 +14,14 @@ output, prefixed with their tag kind.
"""
# Which kind of tags do we need?
-TAG_KINDS = "dpt"
+TAG_KINDS = "dpst"
# Doc sections to use
DOCSECTIONS = ["api"]# ["api", "ext"]
# Only print symbols starting with this prefix,
# to get all symbols, use an empty string
-PREFIX = "Py"
+PREFIXES = ("Py", "PY")
INCLUDEPATTERN = "*.h"
@@ -45,16 +48,21 @@ INCLUDEPATTERN = "*.h"
import os, glob, re, sys, tempfile
-def findnames(file, prefix=""):
+def findnames(file, prefixes=()):
names = {}
- for line in file.readlines():
+ for line in file.xreadlines():
if line[0] == '!':
continue
fields = line.split()
name, tag = fields[0], fields[-1]
if tag == 'd' and name.endswith('_H'):
continue
- if name.startswith(prefix):
+ if prefixes:
+ sw = name.startswith
+ for prefix in prefixes:
+ if sw(prefix):
+ names[name] = tag
+ else:
names[name] = tag
return names
@@ -69,7 +77,8 @@ def print_undoc_symbols(prefix, docdir, incdir):
incfiles = os.path.join(incdir, INCLUDEPATTERN)
- fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s" % (TAG_KINDS, incfiles))
+ fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s"
+ % (TAG_KINDS, incfiles))
dict = findnames(fp, prefix)
names = dict.keys()
names.sort()
@@ -82,4 +91,4 @@ if __name__ == '__main__':
incdir = os.path.normpath(os.path.join(srcdir, "../../Include"))
docdir = os.path.normpath(os.path.join(srcdir, ".."))
- print_undoc_symbols(PREFIX, docdir, incdir)
+ print_undoc_symbols(PREFIXES, docdir, incdir)