[Python-checkins] CVS: python/dist/src/Doc/tools undoc_symbols.py,1.3,1.4
Fred L. Drake
fdrake@users.sourceforge.net
Wed, 28 Nov 2001 20:30:49 -0800
Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv3967
Modified Files:
undoc_symbols.py
Log Message:
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.
Index: undoc_symbols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** undoc_symbols.py 2001/11/12 12:52:01 1.3
--- undoc_symbols.py 2001/11/29 04:30:46 1.4
***************
*** 1,3 ****
! """This script prints out a list of undocumented symbols found in
Python include files, prefixed by their tag kind.
--- 1,6 ----
! #! /usr/bin/env python
!
! """\
! This script prints out a list of undocumented symbols found in
Python include files, prefixed by their tag kind.
***************
*** 12,16 ****
# Which kind of tags do we need?
! TAG_KINDS = "dpt"
# Doc sections to use
--- 15,19 ----
# Which kind of tags do we need?
! TAG_KINDS = "dpst"
# Doc sections to use
***************
*** 19,23 ****
# Only print symbols starting with this prefix,
# to get all symbols, use an empty string
! PREFIX = "Py"
INCLUDEPATTERN = "*.h"
--- 22,26 ----
# Only print symbols starting with this prefix,
# to get all symbols, use an empty string
! PREFIXES = ("Py", "PY")
INCLUDEPATTERN = "*.h"
***************
*** 46,52 ****
import os, glob, re, sys, tempfile
! def findnames(file, prefix=""):
names = {}
! for line in file.readlines():
if line[0] == '!':
continue
--- 49,55 ----
import os, glob, re, sys, tempfile
! def findnames(file, prefixes=()):
names = {}
! for line in file.xreadlines():
if line[0] == '!':
continue
***************
*** 55,59 ****
if tag == 'd' and name.endswith('_H'):
continue
! if name.startswith(prefix):
names[name] = tag
return names
--- 58,67 ----
if tag == 'd' and name.endswith('_H'):
continue
! if prefixes:
! sw = name.startswith
! for prefix in prefixes:
! if sw(prefix):
! names[name] = tag
! else:
names[name] = tag
return names
***************
*** 70,74 ****
incfiles = os.path.join(incdir, INCLUDEPATTERN)
! fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s" % (TAG_KINDS, incfiles))
dict = findnames(fp, prefix)
names = dict.keys()
--- 78,83 ----
incfiles = os.path.join(incdir, INCLUDEPATTERN)
! fp = os.popen("ctags -IDL_IMPORT --c-types=%s -f - %s"
! % (TAG_KINDS, incfiles))
dict = findnames(fp, prefix)
names = dict.keys()
***************
*** 83,85 ****
docdir = os.path.normpath(os.path.join(srcdir, ".."))
! print_undoc_symbols(PREFIX, docdir, incdir)
--- 92,94 ----
docdir = os.path.normpath(os.path.join(srcdir, ".."))
! print_undoc_symbols(PREFIXES, docdir, incdir)