[Python-checkins] CVS: python/dist/src/Doc/tools undoc_symbols.py,1.2,1.3
Thomas Heller
theller@users.sourceforge.net
Mon, 12 Nov 2001 04:52:03 -0800
Update of /cvsroot/python/python/dist/src/Doc/tools
In directory usw-pr-cvs1:/tmp/cvs-serv1214
Modified Files:
undoc_symbols.py
Log Message:
No need to preprocess the header files - use ctags -I flag instead to
remove DL_IMPORT.
Index: undoc_symbols.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tools/undoc_symbols.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** undoc_symbols.py 2001/11/09 17:04:43 1.2
--- undoc_symbols.py 2001/11/12 12:52:01 1.3
***************
*** 2,9 ****
Python include files, prefixed by their tag kind.
! First, a temporary file is written which contains all Python include
! files, with DL_IMPORT simply removed. This file is passed to ctags,
! and the output is parsed into a dictionary mapping symbol names to tag
! kinds.
Then, the .tex files from Python docs are read into a giant string.
--- 2,7 ----
Python include files, prefixed by their tag kind.
! Pass Python's include files to ctags, parse the output into a
! dictionary mapping symbol names to tag kinds.
Then, the .tex files from Python docs are read into a giant string.
***************
*** 17,26 ****
# Doc sections to use
! DOCSECTIONS = ["api", "ext"]
! # Only print symbols starting with this prefix
# to get all symbols, use an empty string
PREFIX = "Py"
# end of customization section
--- 15,26 ----
# 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"
+ INCLUDEPATTERN = "*.h"
+
# end of customization section
***************
*** 58,83 ****
names[name] = tag
return names
-
- def print_undoc_symbols(prefix):
- incfile = tempfile.mktemp(".h")
-
- fp = open(incfile, "w")
-
- for file in glob.glob(os.path.join(INCDIR, "*.h")):
- text = open(file).read()
- # remove all DL_IMPORT, they will confuse ctags
- text = re.sub("DL_IMPORT", "", text)
- fp.write(text)
- fp.close()
docs = []
for sect in DOCSECTIONS:
! for file in glob.glob(os.path.join(DOCDIR, sect, "*.tex")):
docs.append(open(file).read())
docs = "\n".join(docs)
! fp = os.popen("ctags --c-types=%s -f - %s" % (TAG_KINDS, incfile))
dict = findnames(fp, prefix)
names = dict.keys()
--- 58,74 ----
names[name] = tag
return names
+ def print_undoc_symbols(prefix, docdir, incdir):
docs = []
for sect in DOCSECTIONS:
! for file in glob.glob(os.path.join(docdir, sect, "*.tex")):
docs.append(open(file).read())
docs = "\n".join(docs)
! 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()
***************
*** 86,97 ****
if docs.find(name) == -1:
print dict[name], name
- os.remove(incfile)
if __name__ == '__main__':
! global INCDIR
! global DOCDIR
! SRCDIR = os.path.dirname(sys.argv[0])
! INCDIR = os.path.normpath(os.path.join(SRCDIR, "../../Include"))
! DOCDIR = os.path.normpath(os.path.join(SRCDIR, ".."))
! print_undoc_symbols(PREFIX)
--- 77,85 ----
if docs.find(name) == -1:
print dict[name], name
if __name__ == '__main__':
! srcdir = os.path.dirname(sys.argv[0])
! incdir = os.path.normpath(os.path.join(srcdir, "../../Include"))
! docdir = os.path.normpath(os.path.join(srcdir, ".."))
! print_undoc_symbols(PREFIX, docdir, incdir)