+def UpdateLineInFile(path, linePrefix, lineReplace):
+ lines = []
+ with open(path, "r") as f:
+ for l in f.readlines():
+ l = l.rstrip()
+ if l.startswith(linePrefix):
+ lines.append(lineReplace)
+ else:
+ lines.append(l)
+ contents = NATIVE.join(lines) + NATIVE
+ UpdateFile(path, contents)
+
+def UpdateVersionNumbers(root):
+ with open(root + "scintilla/version.txt") as f:
+ version = f.read()
+ versionDotted = version[0] + '.' + version[1] + '.' + version[2]
+ versionCommad = version[0] + ', ' + version[1] + ', ' + version[2] + ', 0'
+
+ UpdateLineInFile(root + "scintilla/win32/ScintRes.rc", "#define VERSION_SCINTILLA",
+ "#define VERSION_SCINTILLA \"" + versionDotted + "\"")
+ UpdateLineInFile(root + "scintilla/win32/ScintRes.rc", "#define VERSION_WORDS",
+ "#define VERSION_WORDS " + versionCommad)
+ UpdateLineInFile(root + "scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro",
+ "VERSION =",
+ "VERSION = " + versionDotted)
+ UpdateLineInFile(root + "scintilla/qt/ScintillaEdit/ScintillaEdit.pro",
+ "VERSION =",
+ "VERSION = " + versionDotted)
+ UpdateLineInFile(root + "scintilla/doc/ScintillaDownload.html", " Release",
+ " Release " + versionDotted)
+ UpdateLineInFile(root + "scintilla/doc/index.html",
+ ' <font color="#FFCC99" size="3"> Release version',
+ ' <font color="#FFCC99" size="3"> Release version ' + versionDotted + '<br />')
+
+ if os.path.exists(root + "scite"):
+ UpdateLineInFile(root + "scite/src/SciTE.h", "#define VERSION_SCITE",
+ "#define VERSION_SCITE \"" + versionDotted + "\"")
+ UpdateLineInFile(root + "scite/src/SciTE.h", "#define VERSION_WORDS",
+ "#define VERSION_WORDS " + versionCommad)
+ UpdateLineInFile(root + "scite/doc/SciTEDownload.html", " Release",
+ " Release " + versionDotted)
+ UpdateLineInFile(root + "scite/doc/SciTE.html",
+ ' <font color="#FFCC99" size="3"> Release version',
+ ' <font color="#FFCC99" size="3"> Release version ' + versionDotted + '<br />')
+