blob: 3455900ece327d1686ec64cb67e54c05af19fee9 [file] [log] [blame]
Lee Thomason27057312012-03-02 09:04:53 -08001# Python program to set the version.
2##############################################
3
4import re
5import sys
6
7def fileProcess( name, lineFunction ):
8 filestream = open( name, 'r' )
9 if filestream.closed:
10 print( "file " + name + " not open." )
11 return
12
13 output = ""
14 print( "--- Processing " + name + " ---------" )
15 while 1:
16 line = filestream.readline()
17 if not line: break
18 output += lineFunction( line )
19 filestream.close()
20
21 if not output: return # basic error checking
22
23 print( "Writing file " + name )
24 filestream = open( name, "w" );
25 filestream.write( output );
26 filestream.close()
27
28
29def echoInput( line ):
30 return line
31
32major = input( "Major: " )
33minor = input( "Minor: " )
34build = input( "Build: " )
35
36print "Setting dox,tinyxml2.h"
37print "Version: " + `major` + "." + `minor` + "." + `build`
38
39#### Write the tinyxml.h ####
40
41def engineRule( line ):
42
43 matchMajor = "static const int TIXML2_MAJOR_VERSION"
44 matchMinor = "static const int TIXML2_MINOR_VERSION"
45 matchBuild = "static const int TIXML2_PATCH_VERSION"
46
47 if line[0:len(matchMajor)] == matchMajor:
48 print "1)tinyxml2.h Major found"
49 return matchMajor + " = " + `major` + ";\n"
50
51 elif line[0:len(matchMinor)] == matchMinor:
52 print "2)tinyxml2.h Minor found"
53 return matchMinor + " = " + `minor` + ";\n"
54
55 elif line[0:len(matchBuild)] == matchBuild:
56 print "3)tinyxml2.h Build found"
57 return matchBuild + " = " + `build` + ";\n"
58
59 else:
60 return line;
61
62fileProcess( "tinyxml2.h", engineRule )
63
64
65#### Write the dox ####
66
67def doxRule( line ):
68
69 match = "PROJECT_NUMBER"
70
71 if line[0:len( match )] == match:
72 print "dox project found"
73 return "PROJECT_NUMBER = " + `major` + "." + `minor` + "." + `build` + "\n"
74
75 else:
76 return line;
77
78fileProcess( "dox", doxRule )
79