Fixes
[ryzomcore.git] / tool / increment_version / increment_version.py
blob3b1d61ad9e8d6be68d08efa08889fddf2212d9bd
2 # Copyright (c) 2015 Jan Boon <jan.boon@kaetemi.be>
3 # All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are met:
8 # * Redistributions of source code must retain the above copyright notice, this
9 # list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright notice,
12 # this list of conditions and the following disclaimer in the documentation
13 # and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 import fileinput
28 import os
30 os.chdir('../../')
31 RootDir = os.getcwd();
33 MajorVersion = 0
34 MinorVersion = 12
35 PatchVersion = 0
36 Revision = 0
38 VersionString = str(MajorVersion) + "." + str(MinorVersion) + "." + str(PatchVersion)
39 VersionComma = str(MajorVersion) + ", " + str(MinorVersion) + ", " + str(PatchVersion) + ", " + str(Revision)
41 for line in fileinput.input("CMakeLists.txt", inplace = True):
42 if ("# Version" in line):
43 print "# Version: " + VersionString
44 elif ("SET(NL_VERSION_MAJOR" in line):
45 print "SET(NL_VERSION_MAJOR " + str(MajorVersion) + ")"
46 elif ("SET(NL_VERSION_MINOR" in line):
47 print "SET(NL_VERSION_MINOR " + str(MinorVersion) + ")"
48 elif ("SET(NL_VERSION_PATCH" in line):
49 print "SET(NL_VERSION_PATCH " + str(PatchVersion) + ")"
50 else:
51 print line.rstrip()
53 os.chdir(RootDir)
54 os.chdir("web/public_php/ams/templates/")
56 for line in fileinput.input("layout.tpl", inplace = True):
57 if (" Powered by: " in line):
58 print "\t\t\t{if $permission > 1}<p class=\"pull-right\">AMS " + VersionString + " Powered by: <a href=\"http://usman.it/free-responsive-admin-template\">Charisma</a></p>{/if}"
59 else:
60 print line.rstrip()
62 os.chdir(RootDir)
63 os.chdir("ryzom/common/src/game_share/")
65 for line in fileinput.input("ryzom_version.h", inplace = True):
66 if (("\"v" in line) and (" \\" in line)):
67 print "\t\"v" + VersionString + "\" \\"
68 else:
69 print line.rstrip()
71 os.chdir(RootDir)
72 os.chdir("nel/tools/3d/plugin_max/")
73 os.chdir("nel_export")
75 for line in fileinput.input("nel_export.rc", inplace = True):
76 if ("FILEVERSION" in line):
77 print " FILEVERSION " + VersionComma
78 elif ("PRODUCTVERSION" in line):
79 print " PRODUCTVERSION " + VersionComma
80 elif (("FileVersion" in line) and ("VALUE" in line)):
81 print " VALUE \"FileVersion\", \"" + VersionString + "\\0\""
82 elif (("ProductVersion" in line) and ("VALUE" in line)):
83 print " VALUE \"ProductVersion\", \"" + VersionString + "\\0\""
84 else:
85 print line.rstrip()
87 os.chdir("..")
88 os.chdir("nel_patch_converter")
90 for line in fileinput.input("nel_patch_converter.rc", inplace = True):
91 if ("FILEVERSION" in line):
92 print " FILEVERSION " + VersionComma
93 elif ("PRODUCTVERSION" in line):
94 print " PRODUCTVERSION " + VersionComma
95 elif (("FileVersion" in line) and ("VALUE" in line)):
96 print " VALUE \"FileVersion\", \"" + VersionString + "\""
97 elif (("ProductVersion" in line) and ("VALUE" in line)):
98 print " VALUE \"ProductVersion\", \"" + VersionString + "\""
99 else:
100 print line.rstrip()
102 os.chdir("..")
103 os.chdir("nel_patch_edit")
105 for line in fileinput.input("mods.rc", inplace = True):
106 if ("FILEVERSION" in line):
107 print " FILEVERSION " + VersionComma
108 elif ("PRODUCTVERSION" in line):
109 print " PRODUCTVERSION " + VersionComma
110 elif (("FileVersion" in line) and ("VALUE" in line)):
111 print " VALUE \"FileVersion\", \"" + VersionString + "\""
112 elif (("ProductVersion" in line) and ("VALUE" in line)):
113 print " VALUE \"ProductVersion\", \"" + VersionString + "\""
114 else:
115 print line.rstrip()
117 os.chdir("..")
118 os.chdir("nel_patch_paint")
120 for line in fileinput.input("nel_patch_paint.rc", inplace = True):
121 if ("FILEVERSION" in line):
122 print " FILEVERSION " + VersionComma
123 elif ("PRODUCTVERSION" in line):
124 print " PRODUCTVERSION " + VersionComma
125 elif (("FileVersion" in line) and ("VALUE" in line)):
126 print " VALUE \"FileVersion\", \"" + VersionString + "\\0\""
127 elif (("ProductVersion" in line) and ("VALUE" in line)):
128 print " VALUE \"ProductVersion\", \"" + VersionString + "\\0\""
129 else:
130 print line.rstrip()
132 os.chdir("..")
133 os.chdir("nel_vertex_tree_paint")
135 for line in fileinput.input("vertex_tree_paint.rc", inplace = True):
136 if ("FILEVERSION" in line):
137 print " FILEVERSION " + VersionComma
138 elif ("PRODUCTVERSION" in line):
139 print " PRODUCTVERSION " + VersionComma
140 elif (("FileVersion" in line) and ("VALUE" in line)):
141 print " VALUE \"FileVersion\", \"" + VersionString + "\\0\""
142 elif (("ProductVersion" in line) and ("VALUE" in line)):
143 print " VALUE \"ProductVersion\", \"" + VersionString + "\\0\""
144 else:
145 print line.rstrip()
147 os.chdir("..")
148 os.chdir("tile_utility")
150 for line in fileinput.input("tile_utility.rc", inplace = True):
151 if ("FILEVERSION" in line):
152 print " FILEVERSION " + VersionComma
153 elif ("PRODUCTVERSION" in line):
154 print " PRODUCTVERSION " + VersionComma
155 elif (("FileVersion" in line) and ("VALUE" in line)):
156 print " VALUE \"FileVersion\", \"" + VersionString + "\\0\""
157 elif (("ProductVersion" in line) and ("VALUE" in line)):
158 print " VALUE \"ProductVersion\", \"" + VersionString + "\\0\""
159 else:
160 print line.rstrip()
162 # end of file