]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/make_installer.py
merged fixes for accel and command event non propagation from 2.2
[wxWidgets.git] / wxPython / distrib / make_installer.py
1 """
2 This script will generate a setup script for InnoSetup and then run it
3 to make the installer executable. If all goes right the proper versions
4 of Python and wxWindows (including hybrid/final settings) will all be
5 calculated based on what wxc.pyd imports and an appropriate installer
6 will be created.
7 """
8
9
10 import os, string
11
12 KEEP_TEMPS = 0
13
14 #----------------------------------------------------------------------
15
16 ISS_Template = r'''
17 ;;------------------------------------------------------------
18
19 [Setup]
20 AppName = wxPython
21 AppVerName = wxPython %(VERSION)s
22 OutputBaseFilename = wxPython-%(VERSION)s-%(PYVER)s
23 AppCopyright = Copyright © 2001 Total Control Software
24 DefaultDirName = {code:GetPythonDir|c:\DoNotInstallHere}
25 DefaultGroupName = wxPython %(SHORTVER)s for Python %(PYTHONVER)s
26 AlwaysCreateUninstallIcon = yes
27
28 ;; SourceDir = .
29 ;; OutputDir is relative to SourceDir
30 OutputDir = dist
31 WizardStyle = modern
32 UninstallStyle = modern
33 DisableStartupPrompt = true
34 CompressLevel = 9
35 DirExistsWarning = no
36 DisableReadyMemo = true
37 DisableReadyPage = true
38 ;;DisableDirPage = true
39 DisableProgramGroupPage = true
40 DisableAppendDir = true
41
42 UninstallFilesDir = {app}\wxPython
43 AppPublisherURL = http://wxPython.org/
44 LicenseFile = licence\licence.txt
45 CodeFile = %(IFSFILE)s
46
47 ;;------------------------------------------------------------
48
49 ;;[Dirs]
50 ;;Name: "{app}\"
51
52 ;;------------------------------------------------------------
53
54 [Components]
55 Name: core; Description: "wxPython modules and library"; Types: full compact custom; Flags: fixed
56 Name: docs; Description: "Documentation"; Types: full
57 Name: demo; Description: "Demo application"; Types: full
58 Name: samples; Description: "Sample applications"; Types: full
59 Name: tools; Description: "Tools"; Types: full
60
61
62 ;;------------------------------------------------------------
63
64 [Files]
65 Source: "%(SYSDIR)s\MSVCRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall restartreplace; Components: core
66 Source: "%(SYSDIR)s\MSVCIRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall restartreplace; Components: core
67
68 Source: "%(WXDIR)s\lib\%(WXDLL)s"; DestDir: "{app}\wxPython"; Components: core
69 Source: "wxPython\wxc.pyd"; DestDir: "{app}\wxPython"; Components: core
70 Source: "wxPython\gridc.pyd"; DestDir: "{app}\wxPython"; Components: core
71 Source: "wxPython\htmlc.pyd"; DestDir: "{app}\wxPython"; Components: core
72 Source: "wxPython\utilsc.pyd"; DestDir: "{app}\wxPython"; Components: core
73 Source: "wxPython\calendarc.pyd"; DestDir: "{app}\wxPython"; Components: core
74 Source: "wxPython\glcanvasc.pyd"; DestDir: "{app}\wxPython"; Components: core
75 Source: "wxPython\oglc.pyd"; DestDir: "{app}\wxPython"; Components: core
76 Source: "wxPython\stc_c.pyd"; DestDir: "{app}\wxPython"; Components: core
77
78 Source: "wxPython\*.py"; DestDir: "{app}\wxPython"; Components: core
79 Source: "wxPython\lib\*.py"; DestDir: "{app}\wxPython\lib"; Components: core
80 Source: "wxPython\lib\editor\*.py"; DestDir: "{app}\wxPython\lib\editor"; Components: core
81 Source: "wxPython\lib\editor\*.txt"; DestDir: "{app}\wxPython\lib\editor"; Components: core
82
83 Source: "demo\*.py"; DestDir: "{app}\wxPython\demo"; Components: demo
84 Source: "demo\*.xml"; DestDir: "{app}\wxPython\demo"; Components: demo
85 Source: "demo\*.txt"; DestDir: "{app}\wxPython\demo"; Components: demo
86
87 Source: "demo\bitmaps\*.gif"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
88 Source: "demo\bitmaps\*.bmp"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
89 Source: "demo\bitmaps\*.jpg"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
90 Source: "demo\bitmaps\*.png"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
91 Source: "demo\bitmaps\*.ico"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
92
93 Source: "demo\data\*.htm"; DestDir: "{app}\wxPython\demo\data"; Components: demo
94 Source: "demo\data\*.html"; DestDir: "{app}\wxPython\demo\data"; Components: demo
95 Source: "demo\data\*.py"; DestDir: "{app}\wxPython\demo\data"; Components: demo
96 Source: "demo\data\*.png"; DestDir: "{app}\wxPython\demo\data"; Components: demo
97 Source: "demo\data\*.bmp"; DestDir: "{app}\wxPython\demo\data"; Components: demo
98 Source: "demo\data\*.i"; DestDir: "{app}\wxPython\demo\data"; Components: demo
99 Source: "demo\data\*.h"; DestDir: "{app}\wxPython\demo\data"; Components: demo
100 Source: "demo\data\*.txt"; DestDir: "{app}\wxPython\demo\data"; Components: demo
101
102 Source: "README.txt"; DestDir: "{app}\wxPython\docs"; Flags: isreadme; Components: core
103 Source: "CHANGES.txt"; DestDir: "{app}\wxPython\docs"; Components: core
104 Source: "licence\*.txt"; DestDir: "{app}\wxPython\docs\licence"; Components: core
105 Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
106 Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
107
108 Source: "tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: tools
109
110 Source: "samples\doodle\*.py"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
111 Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
112 Source: "samples\doodle\sample.ddl"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
113 Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
114 Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
115 Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
116
117 Source: "samples\stxview\*.py"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
118 Source: "samples\stxview\*.stx"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
119 Source: "samples\stxview\*.txt"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
120 Source: "samples\stxview\StructuredText\*.py"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
121
122
123 ;;------------------------------------------------------------
124
125 [Icons]
126 Name: "{group}\Run the DEMO"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "{app}\wxPython\demo"; Parameters: "demo.py";
127 Name: "{group}\wxWindows Referece"; Filename: "{app}\wxPython\docs\wx.chm";
128 Name: "{group}\wxOGL Referece"; Filename: "{app}\wxPython\docs\ogl.chm";
129 Name: "{group}\licence.txt"; Filename: "{app}\wxPython\docs\licence\licence.txt";
130 Name: "{group}\README.txt"; Filename: "{app}\wxPython\docs\README.txt";
131 Name: "{group}\CHANGES.txt"; Filename: "{app}\wxPython\docs\CHANGES.txt";
132 Name: "{group}\Sample Apps"; Filename: "{app}\wxPython\samples"; Components: samples
133
134 ;;Name: "{group}\Uninstall wxPython"; Filename: "{app}\wxPython\unins000.exe"; WorkingDir: "{app}\wxPython";
135
136
137 ;;------------------------------------------------------------
138
139 [UninstallDelete]
140 Type: files; Name: "{app}\wxPython\*.pyc";
141 Type: files; Name: "{app}\wxPython\*.pyo";
142 Type: files; Name: "{app}\wxPython\lib\*.pyc";
143 Type: files; Name: "{app}\wxPython\lib\*.pyo";
144 Type: files; Name: "{app}\wxPython\lib\editor\*.pyc";
145 Type: files; Name: "{app}\wxPython\lib\editor\*.pyo";
146 Type: files; Name: "{app}\wxPython\demo\*.pyc";
147 Type: files; Name: "{app}\wxPython\demo\*.pyo";
148 Type: files; Name: "{app}\wxPython\demo\data\showTips";
149 Type: files; Name: "{app}\wxPython\tools\*.pyc";
150 Type: files; Name: "{app}\wxPython\tools\*.pyo";
151 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyc";
152 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyo";
153 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyc";
154 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyo";
155 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyc";
156 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyo";
157 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyc";
158 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyo";
159
160 '''
161
162
163 #----------------------------------------------------------------------
164
165 IFS_Template = r"""
166 program Setup;
167 var
168 PythonDir : String;
169
170 function InitializeSetup(): Boolean;
171 begin
172 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
173 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
174 '', PythonDir) then begin
175 MsgBox('No installation of Python %(PYTHONVER)s found. Aborting...',
176 mbConfirmation, MB_OK);
177 Result := false;
178 end else
179 Result := true;
180 end;
181
182
183 function GetPythonDir(Default: String): String;
184 begin
185 Result := PythonDir;
186 end;
187
188 begin
189 end.
190
191 """
192
193
194 #----------------------------------------------------------------------
195
196 def find_DLLs():
197
198 WXDLL = PYTHONVER = None
199
200 proc = os.popen(r"dumpbin /imports wxPython\wxc.pyd", "r")
201 lines = proc.readlines()
202 proc.close()
203 for line in lines:
204 if line[:6] == " wx":
205 WXDLL = string.strip(line)
206
207 if line[:10] == " python":
208 PYTHONVER = line[10] + '.' + line[11]
209
210 if WXDLL and PYTHONVER:
211 return WXDLL, PYTHONVER
212
213
214 #----------------------------------------------------------------------
215
216 def main():
217
218 verglob = {}
219 execfile("wxPython/__version__.py", verglob)
220
221 VERSION = verglob["ver"]
222 SHORTVER = VERSION[:3]
223
224 WXDLL, PYTHONVER = find_DLLs()
225
226 PYVER = "Py" + PYTHONVER[0] + PYTHONVER[2]
227 WXDIR = os.environ["WXWIN"]
228 WXPYDIR = os.path.join(WXDIR, "wxPython")
229 SYSDIR = r"C:\WINNT\SYSTEM32"
230 ISSFILE = "__wxPython.iss"
231 IFSFILE = "__wxPython.ifs"
232
233
234 if string.find(WXDLL, "h") != -1:
235 PYVER = PYVER + "-hybrid"
236
237 f = open(ISSFILE, "w")
238 f.write(ISS_Template % vars())
239 f.close()
240
241 f = open(IFSFILE, "w")
242 f.write(IFS_Template % vars())
243 f.close()
244
245 os.system(r"C:\TOOLS\InnoSetup2Ex\ISCC.exe %s" % ISSFILE)
246
247 if not KEEP_TEMPS:
248 os.remove(ISSFILE)
249 os.remove(IFSFILE)
250
251
252 #----------------------------------------------------------------------
253
254 if __name__ == "__main__":
255 main()
256
257
258
259 #----------------------------------------------------------------------
260
261