3 # Copyright (C) 2008 Kevin Ollivier All rights reserved.
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions
8 # 1. Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # 2. Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 # Create a Windows installer package for wxPython wxWebKit binaries
28 import sys, os, string
32 from subprocess import *
36 script_dir = os.path.abspath(os.path.dirname(__file__))
37 sys.path.append(os.path.abspath(os.path.join(script_dir, "..", "..", "waf", "build")))
39 from build_utils import *
41 wxwk_root = os.path.abspath(os.path.join(script_dir, "..", "..", ".."))
42 wxwebkit_dir = os.path.abspath(os.path.join(wxwk_root, "WebKitBuild", get_config(wxwk_root) + git_branch_name()))
44 # Find InnoSetup executable
45 def getInnoSetupPath():
48 dirs = os.environ["PATH"].split(":")
49 # Add the default file path
50 dirs.append("C:\\Program Files\\Inno Setup 5")
51 dirs.append("C:\\Program Files (x86)\\Inno Setup 5")
53 if os.environ.has_key("INNO5"):
54 retval = os.environ["INNO5"]
58 filepath = os.path.join(dir, name)
59 if os.path.isfile(filepath):
64 if __name__ == "__main__":
65 innoSetup = getInnoSetupPath()
68 date = str(datetime.date.today())
70 if not os.path.exists(innoSetup):
71 print "ERROR: Cannot find InnoSetup."
74 if not os.path.exists(wxwebkit_dir):
75 print "ERROR: Build dir %s doesn't exist." % wxwebkit_dir
79 CopyMode: alwaysoverwrite; Source: *.pyd; DestDir: "{app}"
80 CopyMode: alwaysoverwrite; Source: *.py; DestDir: "{app}"
83 dlls = glob.glob(os.path.join(wxwebkit_dir, "*.dll"))
85 if dll.find("wxbase") == -1 and dll.find("wxmsw") == -1:
86 fileList += """CopyMode: alwaysoverwrite; Source: %s; DestDir: "{app}" \n""" % dll
88 installerTemplate = open("wxWebKitInstaller.iss.in", "r").read()
90 wx_version = '%d.%d' % (wx.MAJOR_VERSION, wx.MINOR_VERSION)
91 if wx.MINOR_VERSION % 2 == 1:
92 wx_version += ".%d" % wx.RELEASE_VERSION
94 # in 2.9/3.0, there are only unicode builds, so unicode has been removed
96 if wx.MAJOR_VERSION > 2 or wx.MINOR_VERSION > 8:
97 installerTemplate = installerTemplate.replace("msw-unicode", "msw")
99 installerTemplate = installerTemplate.replace("<<VERSION>>", date)
100 installerTemplate = installerTemplate.replace("<<WXVERSION>>", wx_version)
101 installerTemplate = installerTemplate.replace("<<ROOTDIR>>", wxwebkit_dir )
102 installerTemplate = installerTemplate.replace("<<PYTHONVER>>", sys.version[0:3] )
103 installerTemplate = installerTemplate.replace("<<FILES>>", fileList )
105 outputFile = open("wxWebKitInstaller.iss", "w")
106 outputFile.write(installerTemplate)
109 success = os.system('"%s" wxWebKitInstaller.iss' % innoSetup)