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):
13 line
= line
.replace(s
, r
)
14 sys
.stdout
.write(line
)
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/IPlugPlush-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/IPlugPlush-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/IPlugPlush-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/IPlugPlush-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/IPlugPlush-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/IPlugPlush-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/IPlugPlush-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/IPlugPlush.pkgproj"
100 installer
= plistlib
.readPlist(plistpath
)
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/IPlugPlush.iss",inplace
=1):
111 if "AppVersion" in line
:
112 line
="AppVersion=" + FullVersionStr
+ "\n"
113 sys
.stdout
.write(line
)
115 if __name__
== '__main__':