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