wxWidgets/misc/scripts/update_doc_utils.py
Vadim Zeitlin 3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00

49 lines
1.7 KiB
Python
Executable File

##############################################################################
# Name: misc/scripts/update_doc_utils.py
# Purpose: base utilities for others update_doc_*.py scripts
# Created: 2007-08-1
# Copyright: (c) 2007 Francesco Montorsi
# Licence: wxWindows licence
##############################################################################
import sys, os, glob, distutils.file_util
DOCS_PATH="../../docs/latex/wx"
# Calls the given callback with the name of a documented class, its .tex related file,
# the content of that .tex file and the number of the line of the relative \class tag,
# for all documented class in DOCS_PATH. If the callback returns false the processing is stopped.
# Returns the number of .tex files processed.
def scanTexFiles(callback):
count = 0
for f in glob.glob(DOCS_PATH + '/*.tex'):
file = open(f, "r")
if not file:
print "could not open %s" % f
continue
print "opened file %s" % f
count = count + 1
# search \class tags
content = file.readlines()
classdecl = 0
for i in range(len(content)):
line = content[i]
if "\class{" in line:
classdecl = classdecl + 1
# polish the class name
classname = line
classname = classname[classname.find("\class{"):]
classname = classname[classname.find("{")+1:classname.find("}")]
print " the class declared is named '%s'" % classname
# process this \class
if not callback(classname, f, content, i):
return count
print " file %s contains %d class declarations" % (f, classdecl)
return count