aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorNeil Hodgson <nyamatongwe@gmail.com>2015-09-21 10:45:47 +1000
committerNeil Hodgson <nyamatongwe@gmail.com>2015-09-21 10:45:47 +1000
commitb3f9c327aa225b38a2433e313d2772d9fd1e54bc (patch)
treed40bcd114cc6527b5dacd03950f8053f811faa61 /scripts
parent8e2d5499a510de74c6f991273a864459fa30ac49 (diff)
downloadscintilla-mirror-b3f9c327aa225b38a2433e313d2772d9fd1e54bc.tar.gz
Automate updating of version numbers in the Scintilla framework.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/FileGenerator.py19
-rw-r--r--[-rwxr-xr-x]scripts/LexGen.py6
2 files changed, 24 insertions, 1 deletions
diff --git a/scripts/FileGenerator.py b/scripts/FileGenerator.py
index 01a79bf99..e2750ebe0 100644
--- a/scripts/FileGenerator.py
+++ b/scripts/FileGenerator.py
@@ -137,6 +137,25 @@ def Regenerate(filename, commentPrefix, *lists):
"""
Generate(filename, filename, commentPrefix, *lists)
+def UpdateLineInPlistFile(path, key, value):
+ """Replace a single string value preceded by 'key' in an XML plist file.
+ """
+ lines = []
+ keyCurrent = ""
+ with codecs.open(path, "rb", "utf-8") as f:
+ for l in f.readlines():
+ ls = l.strip()
+ if ls.startswith("<key>"):
+ keyCurrent = ls.replace("<key>", "").replace("</key>", "")
+ elif ls.startswith("<string>"):
+ if keyCurrent == key:
+ start, tag, rest = l.partition("<string>")
+ val, etag, end = rest.partition("</string>")
+ l = start + tag + value + etag + end
+ lines.append(l)
+ contents = "".join(lines)
+ UpdateFile(path, contents)
+
def UpdateLineInFile(path, linePrefix, lineReplace):
lines = []
updated = False
diff --git a/scripts/LexGen.py b/scripts/LexGen.py
index f2496be2a..934968c27 100755..100644
--- a/scripts/LexGen.py
+++ b/scripts/LexGen.py
@@ -8,7 +8,7 @@
# Files are regenerated in place with templates stored in comments.
# The format of generation comments is documented in FileGenerator.py.
-from FileGenerator import Regenerate, UpdateLineInFile, ReplaceREInFile
+from FileGenerator import Regenerate, UpdateLineInFile, ReplaceREInFile, UpdateLineInPlistFile
import ScintillaData
import HFacer
@@ -38,6 +38,10 @@ def UpdateVersionNumbers(sci, root):
UpdateLineInFile(root + "doc/ScintillaHistory.html",
' Released ',
' Released ' + sci.dmyModified + '.')
+ UpdateLineInPlistFile(root + "cocoa/ScintillaFramework/Info.plist",
+ "CFBundleVersion", sci.versionDotted)
+ UpdateLineInPlistFile(root + "cocoa/ScintillaFramework/Info.plist",
+ "CFBundleShortVersionString", sci.versionDotted)
def RegenerateAll(root):