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