Debian Codegraph @

addon/doxmlparser/generateDS_post.py

raw
1 #!/usr/bin/env python
2 #
3 # Copyright (C) 1997-2022 by Dimitri van Heesch.
4 #
5 # Permission to use, copy, modify, and distribute this software and its
6 # documentation under the terms of the GNU General Public License is hereby
7 # granted. No representations are made about the suitability of this software
8 # for any purpose. It is provided "as is" without express or implied warranty.
9 # See the GNU General Public License for more details.
10 #
11 # Documents produced by Doxygen are derivative works derived from the
12 # input used in their production; they are not affected by this license.
13
14 import sys
15 import re
16
17 def main():
18 inputFile = open(sys.argv[1], 'r')
19 outputFile = open(sys.argv[2], 'wb')
20 for line in inputFile:
21 line = line.rstrip()
22 line = re.sub(r'##','# #',line)
23 line = re.sub(r'# Python.*','#',line)
24 line = re.sub(r"('-o', ').*(/addon/doxmlparser/doxmlparser)","\\1...\\2",line)
25 # python 2 slips the u in ...
26 line = re.sub(r"u'","'",line)
27
28 if line.find("generateDS") == -1:
29 line = re.sub(r'(# ).*(/templates/xml/)','\\1...\\2',line)
30 else:
31 line = re.sub(r'(# ).*generateDS(.* -o ").*(/addon/doxmlparser/doxmlparser/.* ).*(/templates/xml/)',
32 '\\1.../generateDS\\2...\\3...\\4',line)
33 if line.find(" self") == 0:
34 line = " " + line
35 outputFile.write(str.encode(line))
36 outputFile.write(str.encode('\n'))
37
38
39 if __name__ == '__main__':
40 main()