-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_version.py
116 lines (91 loc) · 4.32 KB
/
update_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/usr/bin/python
# this script will update the versions in plist and installer files to match that in resource.h
import plistlib, os, datetime, fileinput, glob, sys, string
scriptpath = os.path.dirname(os.path.realpath(__file__))
def replacestrs(filename, s, r):
files = glob.glob(filename)
for line in fileinput.input(files,inplace=1):
string.find(line, s)
line = line.replace(s, r)
sys.stdout.write(line)
def main():
MajorStr = ""
MinorStr = ""
BugfixStr = ""
for line in fileinput.input(scriptpath + "/resource.h",inplace=0):
if "#define PLUG_VER " in line:
FullVersion = int(string.lstrip(line, "#define PLUG_VER "), 16)
major = FullVersion & 0xFFFF0000
MajorStr = str(major >> 16)
minor = FullVersion & 0x0000FF00
MinorStr = str(minor >> 8)
BugfixStr = str(FullVersion & 0x000000FF)
FullVersionStr = MajorStr + "." + MinorStr + "." + BugfixStr
today = datetime.date.today()
CFBundleGetInfoString = FullVersionStr + ", Copyright Will, " + str(today.year)
CFBundleVersion = FullVersionStr
print "update_version.py - setting version to " + FullVersionStr
print "Updating plist version info..."
plistpath = scriptpath + "/resources/PancakeHouse-VST2-Info.plist"
vst2 = plistlib.readPlist(plistpath)
vst2['CFBundleGetInfoString'] = CFBundleGetInfoString
vst2['CFBundleVersion'] = CFBundleVersion
vst2['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(vst2, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
plistpath = scriptpath + "/resources/PancakeHouse-AU-Info.plist"
au = plistlib.readPlist(plistpath)
au['CFBundleGetInfoString'] = CFBundleGetInfoString
au['CFBundleVersion'] = CFBundleVersion
au['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(au, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
plistpath = scriptpath + "/resources/PancakeHouse-VST3-Info.plist"
vst3 = plistlib.readPlist(plistpath)
vst3['CFBundleGetInfoString'] = CFBundleGetInfoString
vst3['CFBundleVersion'] = CFBundleVersion
vst3['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(vst3, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
plistpath = scriptpath + "/resources/PancakeHouse-OSXAPP-Info.plist"
app = plistlib.readPlist(plistpath)
app['CFBundleGetInfoString'] = CFBundleGetInfoString
app['CFBundleVersion'] = CFBundleVersion
app['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(app, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
plistpath = scriptpath + "/resources/PancakeHouse-RTAS-Info.plist"
rtas = plistlib.readPlist(plistpath)
rtas['CFBundleGetInfoString'] = CFBundleGetInfoString
rtas['CFBundleVersion'] = CFBundleVersion
rtas['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(rtas, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
plistpath = scriptpath + "/resources/PancakeHouse-AAX-Info.plist"
aax = plistlib.readPlist(plistpath)
aax['CFBundleGetInfoString'] = CFBundleGetInfoString
aax['CFBundleVersion'] = CFBundleVersion
aax['CFBundleShortVersionString'] = CFBundleVersion
plistlib.writePlist(aax, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
# plistpath = scriptpath + "/resources/PancakeHouse-IOSAPP-Info.plist"
# iosapp = plistlib.readPlist(plistpath)
# iosapp['CFBundleGetInfoString'] = CFBundleGetInfoString
# iosapp['CFBundleVersion'] = CFBundleVersion
# iosapp['CFBundleShortVersionString'] = CFBundleVersion
# plistlib.writePlist(iosapp, plistpath)
# replacestrs(plistpath, "//Apple//", "//Apple Computer//");
print "Updating Mac Installer version info..."
plistpath = scriptpath + "/installer/PancakeHouse.pkgproj"
installer = plistlib.readPlist(plistpath)
for x in range(0,6):
installer['PACKAGES'][x]['PACKAGE_SETTINGS']['VERSION'] = FullVersionStr
plistlib.writePlist(installer, plistpath)
replacestrs(plistpath, "//Apple//", "//Apple Computer//");
print "Updating Windows Installer version info..."
for line in fileinput.input(scriptpath + "/installer/PancakeHouse.iss",inplace=1):
if "AppVersion" in line:
line="AppVersion=" + FullVersionStr + "\n"
sys.stdout.write(line)
if __name__ == '__main__':
main()