]> git.saurik.com Git - wxWidgets.git/blame - misc/scripts/update_doc_utils.py
using #ifdef wxABORT_ON_CONFIG_ERROR not just #if as elsewhere
[wxWidgets.git] / misc / scripts / update_doc_utils.py
CommitLineData
61f2782a
VZ
1##############################################################################
2# Name: misc/scripts/update_doc_utils.py
3# Purpose: base utilities for others update_doc_*.py scripts
4# Created: 2007-08-1
61f2782a
VZ
5# Copyright: (c) 2007 Francesco Montorsi
6# Licence: wxWindows licence
7##############################################################################
8
9import sys, os, glob, distutils.file_util
10
11DOCS_PATH="../../docs/latex/wx"
12
13# Calls the given callback with the name of a documented class, its .tex related file,
14# the content of that .tex file and the number of the line of the relative \class tag,
15# for all documented class in DOCS_PATH. If the callback returns false the processing is stopped.
16# Returns the number of .tex files processed.
17def scanTexFiles(callback):
18 count = 0
19 for f in glob.glob(DOCS_PATH + '/*.tex'):
20 file = open(f, "r")
21 if not file:
22 print "could not open %s" % f
23 continue
24 print "opened file %s" % f
25 count = count + 1
26
27 # search \class tags
28 content = file.readlines()
29 classdecl = 0
30 for i in range(len(content)):
31 line = content[i]
32 if "\class{" in line:
33 classdecl = classdecl + 1
34
35 # polish the class name
36 classname = line
37 classname = classname[classname.find("\class{"):]
38 classname = classname[classname.find("{")+1:classname.find("}")]
39 print " the class declared is named '%s'" % classname
40
41 # process this \class
42 if not callback(classname, f, content, i):
43 return count
44
45 print " file %s contains %d class declarations" % (f, classdecl)
46
47 return count
48