]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/make_installer.py
Added the sample code from wxPython In Action to the samples dir
[wxWidgets.git] / wxPython / distrib / make_installer.py
1 # -*- coding: iso-8859-1 -*-
2 #----------------------------------------------------------------------
3 # Name: make_installer.py
4 # Purpose: A script to create the wxPython windows installer
5 #
6 # Author: Robin Dunn
7 #
8 # Created: 30-April-2001
9 # RCS-ID: $Id$
10 # Copyright: (c) 2003 by Total Control Software
11 # Licence: wxWindows license
12 #----------------------------------------------------------------------
13
14 """
15 This script will generate a setup script for InnoSetup and then run it
16 to make the installer executable. If all goes right the proper versions
17 of Python and wxWindows (including hybrid/final settings) will all be
18 calculated based on what _core_.pyd imports and an appropriate installer
19 will be created.
20 """
21
22
23 import sys, os, time
24
25 KEEP_TEMPS = False
26 # default InnoSetup installer location
27 ISCC = r"%s\InnoSetup5\ISCC.exe %s"
28
29 if os.environ.has_key("INNO5"):
30 ISCC = os.environ["INNO5"]
31
32
33 #----------------------------------------------------------------------
34
35 ISS_Template = r'''
36
37 [Setup]
38 AppName = wxPython%(SHORTVER)s-%(CHARTYPE)s-%(PYVER)s
39 AppVerName = wxPython %(VERSION)s (%(CHARTYPE)s) for Python %(PYTHONVER)s
40 OutputBaseFilename = wxPython%(SHORTVER)s-win32-%(CHARTYPE)s-%(VERSION)s-%(PYVER)s
41 AppCopyright = Copyright © 2006 Total Control Software
42 DefaultDirName = {code:GetInstallDir|c:\DoNotInstallHere}
43 DefaultGroupName = wxPython %(VERSION)s (%(CHARTYPE)s) for Python %(PYTHONVER)s
44 PrivilegesRequired = none
45 OutputDir = dist
46 DisableStartupPrompt = true
47 Compression = bzip
48 SolidCompression = yes
49 DirExistsWarning = no
50 DisableReadyMemo = true
51 DisableReadyPage = true
52 ;;DisableDirPage = true
53 DisableProgramGroupPage = true
54 UsePreviousAppDir = no
55 UsePreviousGroup = no
56
57 AppPublisher = Total Control Software
58 AppPublisherURL = http://wxPython.org/
59 AppSupportURL = http://wxPython.org/maillist.php
60 AppUpdatesURL = http://wxPython.org/download.php
61 AppVersion = %(VERSION)s-%(CHARTYPE)s
62
63 UninstallFilesDir = {app}\%(PKGDIR)s
64 LicenseFile = licence\licence.txt
65
66
67 ;;------------------------------------------------------------
68
69 [Components]
70 Name: core; Description: "wxPython modules and library"; Types: full custom; Flags: fixed
71 Name: manifest; Description: "Manifest files for XP Themed LnF"; Types: full
72 Name: pthfile; Description: "Make this install be the default wxPython"; Types: full
73
74 ;;------------------------------------------------------------
75
76 [Files]
77 %(RTDLL)s
78 Source: "distrib\msw\gdiplus.dll"; DestDir: "{app}\%(PKGDIR)s\wx"; Check: OnlyBeforeXP; Flags: sharedfile; Components: core
79 Source: "%(WXDIR)s\lib\vc_dll\wx*%(WXDLLVER)s_*.dll"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: replacesameversion
80 %(MSLU)s
81
82 Source: "wx\_activex.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
83 Source: "wx\_calendar.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
84 Source: "wx\_controls_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
85 Source: "wx\_core_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
86 Source: "wx\_gdi_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
87 Source: "wx\_animate.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
88 Source: "wx\_gizmos.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
89 Source: "wx\_glcanvas.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
90 Source: "wx\_grid.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
91 Source: "wx\_html.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
92 Source: "wx\_media.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
93 Source: "wx\_misc_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
94 Source: "wx\_stc.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
95 Source: "wx\_webkit.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
96 Source: "wx\_windows_.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
97 Source: "wx\_wizard.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
98 Source: "wx\_xrc.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
99 Source: "wx\_aui.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
100 Source: "wx\_richtext.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
101 ;;Source: "wx\_iewin.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
102 ;;Source: "wx\_ogl.pyd"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core; Flags: comparetimestamp
103
104
105 Source: "wx\*.py"; DestDir: "{app}\%(PKGDIR)s\wx"; Components: core
106 Source: "wx\build\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\build"; Components: core
107 Source: "wx\lib\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib"; Components: core
108 Source: "wx\lib\analogclock\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\analogclock"; Components: core
109 Source: "wx\lib\analogclock\lib_setup\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\analogclock\lib_setup"; Components: core
110 Source: "wx\lib\colourchooser\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\colourchooser"; Components: core
111 Source: "wx\lib\editor\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\editor"; Components: core
112 Source: "wx\lib\editor\*.txt"; DestDir: "{app}\%(PKGDIR)s\wx\lib\editor"; Components: core
113 Source: "wx\lib\mixins\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\mixins"; Components: core
114 Source: "wx\lib\masked\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\masked"; Components: core
115 Source: "wx\lib\ogl\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\ogl"; Components: core
116 Source: "wx\lib\floatcanvas\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\lib\floatcanvas"; Components: core
117 Source: "wx\py\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\py"; Components: core
118 Source: "wx\py\*.txt"; DestDir: "{app}\%(PKGDIR)s\wx\py"; Components: core
119 Source: "wx\py\*.ico"; DestDir: "{app}\%(PKGDIR)s\wx\py"; Components: core
120 Source: "wx\py\*.png"; DestDir: "{app}\%(PKGDIR)s\wx\py"; Components: core
121 Source: "wx\py\tests\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\py\tests"; Components: core
122 Source: "wx\tools\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\tools"; Components: core
123 Source: "wx\tools\XRCed\*.txt"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
124 Source: "wx\tools\XRCed\sawfishrc"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
125 Source: "wx\tools\XRCed\*.py"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
126 Source: "wx\tools\XRCed\*.xrc"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
127 Source: "wx\tools\XRCed\*.ico"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
128 Source: "wx\tools\XRCed\*.png"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
129 Source: "wx\tools\XRCed\*.sh"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed"; Components: core
130 Source: "wx\tools\XRCed\src-images\*.png"; DestDir: "{app}\%(PKGDIR)s\wx\tools\XRCed\src-images"; Components: core
131
132
133 Source: "wxPython\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython"; Components: core
134 Source: "wxPython\lib\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython\lib"; Components: core
135 Source: "wxPython\lib\colourchooser\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython\lib\colourchooser"; Components: core
136 Source: "wxPython\lib\editor\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython\lib\editor"; Components: core
137 Source: "wxPython\lib\mixins\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython\lib\mixins"; Components: core
138 Source: "wxPython\tools\*.py"; DestDir: "{app}\%(PKGDIR)s\wxPython\tools"; Components: core
139
140
141 Source: "src\winxp.manifest"; DestDir: "{code:GetPythonDir}"; DestName: "python.exe.manifest"; Flags: sharedfile; Components: manifest
142 Source: "src\winxp.manifest"; DestDir: "{code:GetPythonDir}"; DestName: "pythonw.exe.manifest"; Flags: sharedfile; Components: manifest
143 Source: "wxversion\wxversion.py"; DestDir: "{app}"; Flags: sharedfile; Components: core
144 Source: "wxaddons\*.py"; DestDir: "{app}\wxaddons"; Flags: sharedfile; Components: core
145 Source: "src\wx.pth"; DestDir: "{app}"; Flags: sharedfile; Components: pthfile
146
147 %(LOCALE)s
148
149
150 Source: "scripts\*.py"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
151 Source: "scripts\helpviewer"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
152 Source: "scripts\img2png"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
153 Source: "scripts\img2py"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
154 Source: "scripts\img2xpm"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
155 Source: "scripts\pyalacarte"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
156 Source: "scripts\pyalamode"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
157 Source: "scripts\pyshell"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
158 Source: "scripts\pycrust"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
159 Source: "scripts\pywrap"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
160 Source: "scripts\pywxrc"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
161 Source: "scripts\xrced"; DestDir: "{code:GetPythonDir}\Scripts"; Flags: sharedfile; Components: core
162
163
164 Source: "distrib\README.win32.txt"; DestDir: "{app}\%(PKGDIR)s\docs"; Flags: isreadme; Components: core
165 Source: "licence\*.txt"; DestDir: "{app}\%(PKGDIR)s\docs\licence"; Components: core
166 Source: "docs\CHANGES.*"; DestDir: "{app}\%(PKGDIR)s\docs"; Components: core
167 Source: "docs\MigrationGuide.*"; DestDir: "{app}\%(PKGDIR)s\docs"; Components: core
168 Source: "docs\default.css"; DestDir: "{app}\%(PKGDIR)s\docs"; Components: core
169
170
171
172 ;;------------------------------------------------------------
173
174 [Run]
175 ;; Compile the .py files
176 Filename: "{code:GetPythonDir}\python.exe"; Parameters: "{code:GetPythonDir}\Lib\compileall.py {app}\%(PKGDIR)s"; Description: "Compile Python .py files to .pyc"; Flags: postinstall; Components: core
177
178 ;; Recreate the tool scripts to use the paths on the users machine
179 Filename: "{code:GetPythonDir}\python.exe"; Parameters: "CreateBatchFiles.py"; WorkingDir: "{code:GetPythonDir}\Scripts"; Description: "Create batch files for tool scripts"; Flags: postinstall; Components: core
180
181
182
183
184 ;;------------------------------------------------------------
185
186 [UninstallDelete]
187 Type: files; Name: "{app}\%(PKGDIR)s\wx\*.pyc";
188 Type: files; Name: "{app}\%(PKGDIR)s\wx\*.pyo";
189 Type: files; Name: "{app}\%(PKGDIR)s\wx\*.pyd";
190 Type: files; Name: "{app}\%(PKGDIR)s\wx\build\*.pyc";
191 Type: files; Name: "{app}\%(PKGDIR)s\wx\build\*.pyo";
192 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\*.pyc";
193 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\*.pyo";
194 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\analogclock\*.pyc";
195 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\analogclock\*.pyo";
196 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\analogclock\lib_setup\*.pyc";
197 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\analogclock\lib_setup\*.pyo";
198 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\colourchooser\*.pyc";
199 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\colourchooser\*.pyo";
200 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\editor\*.pyc";
201 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\editor\*.pyo";
202 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\mixins\*.pyc";
203 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\mixins\*.pyo";
204 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\masked\*.pyc";
205 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\masked\*.pyo";
206 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\ogl\*.pyc";
207 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\ogl\*.pyo";
208 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\floatcanvas\*.pyc";
209 Type: files; Name: "{app}\%(PKGDIR)s\wx\lib\floatcanvas\*.pyo";
210
211 Type: files; Name: "{app}\%(PKGDIR)s\wx\py\*.pyc";
212 Type: files; Name: "{app}\%(PKGDIR)s\wx\py\*.pyo";
213 Type: files; Name: "{app}\%(PKGDIR)s\wx\py\tests\*.pyc";
214 Type: files; Name: "{app}\%(PKGDIR)s\wx\py\tests\*.pyo";
215 Type: files; Name: "{app}\%(PKGDIR)s\wx\tools\*.pyc";
216 Type: files; Name: "{app}\%(PKGDIR)s\wx\tools\*.pyo";
217 Type: files; Name: "{app}\%(PKGDIR)s\wx\tools\XRCed\*.pyc";
218 Type: files; Name: "{app}\%(PKGDIR)s\wx\tools\XRCed\*.pyo";
219
220
221 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\*.pyc";
222 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\*.pyo";
223 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\*.pyc";
224 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\*.pyo";
225 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\colourchooser\*.pyc";
226 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\colourchooser\*.pyo";
227 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\editor\*.pyc";
228 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\editor\*.pyo";
229 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\mixins\*.pyc";
230 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\lib\mixins\*.pyo";
231 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\tools\*.pyc";
232 Type: files; Name: "{app}\%(PKGDIR)s\wxPython\tools\*.pyo";
233
234 Type: files; Name: "{app}\wxversion.pyc";
235 Type: files; Name: "{app}\wxversion.pyo";
236
237 Type: files; Name: "{app}\%(PKGDIR)s\wxaddons\*.pyc";
238 Type: files; Name: "{app}\%(PKGDIR)s\wxaddons\*.pyo";
239
240 %(UNINSTALL_BATCH)s
241
242 ''' + """
243 ;----------------------------------------------------------------------
244
245 [Code]
246
247 program Setup;
248 var
249 PythonDir : String;
250 InstallDir : String;
251
252
253 function InitializeSetup(): Boolean;
254 begin
255
256 (* -------------------------------------------------------------- *)
257 (* Figure out what to use as a default installation dir *)
258
259 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
260 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
261 '', PythonDir) then begin
262
263 if not RegQueryStringValue(HKEY_CURRENT_USER,
264 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
265 '', PythonDir) then begin
266
267 MsgBox('No installation of Python %(PYTHONVER)s found in registry.' + #13 +
268 'Be sure to enter a pathname that places wxPython on the PYTHONPATH',
269 mbConfirmation, MB_OK);
270 PythonDir := 'C:\Put a directory on PYTHONPATH here\';
271 end;
272 end;
273 InstallDir := PythonDir;
274 %(IF22)s
275
276 Result := True;
277 end;
278
279
280
281 function GetPythonDir(Default: String): String;
282 begin
283 Result := PythonDir;
284 end;
285
286
287
288 function GetInstallDir(Default: String): String;
289 begin
290 Result := InstallDir;
291 end;
292
293
294
295 function UninstallOld(FileName: String): Boolean;
296 var
297 ResultCode: Integer;
298 begin
299 Result := False;
300 if FileExists(FileName) then begin
301 Result := True;
302 ResultCode := MsgBox('A prior wxPython installation was found in this directory. It' + #13 +
303 'is recommended that it be uninstalled first.' + #13#13 +
304 'Should I do it?',
305 mbConfirmation, MB_YESNO);
306 if ResultCode = IDYES then begin
307 Exec(FileName, '/SILENT', WizardDirValue(), SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
308
309 end;
310 end;
311 end;
312
313
314
315 function NextButtonClick(CurPage: Integer): Boolean;
316 begin
317 Result := True;
318 if CurPage <> wpSelectDir then Exit;
319 if not UninstallOld(WizardDirValue() + '\wxPython\unins000.exe') then
320 if not UninstallOld(WizardDirValue() + '\wx\unins000.exe') then
321 UninstallOld(WizardDirValue() + '\%(PKGDIR)s\unins000.exe')
322 end;
323
324
325
326 function OnlyBeforeXP(): Boolean;
327 var
328 Version: TWindowsVersion;
329 begin
330 GetWindowsVersionEx(Version);
331 Result := True;
332 if (Version.Major > 5) or ((Version.Major = 5) and (Version.Minor >= 1)) then begin
333 Result := False;
334 end;
335 end;
336
337
338 begin
339 end.
340
341 """
342
343 #----------------------------------------------------------------------
344
345 ISS_DocDemo_Template = r'''
346
347 [Setup]
348 AppName = wxPython%(SHORTVER)s-docs-demos
349 AppVerName = wxPython Docs and Demos %(VERSION)s
350 OutputBaseFilename = wxPython%(SHORTVER)s-win32-docs-demos-%(VERSION)s
351 AppCopyright = Copyright © 2006 Total Control Software
352 DefaultDirName = {pf}\wxPython%(SHORTVER)s Docs and Demos
353 DefaultGroupName = wxPython%(SHORTVER)s Docs Demos and Tools
354 PrivilegesRequired = none
355 OutputDir = dist
356 WizardStyle = modern
357 DisableStartupPrompt = true
358 Compression = bzip
359 DirExistsWarning = no
360 DisableReadyMemo = true
361 DisableReadyPage = true
362 ;;DisableDirPage = true
363 DisableProgramGroupPage = no
364 UsePreviousAppDir = no
365 UsePreviousGroup = no
366
367 AppPublisher = Total Control Software
368 AppPublisherURL = http://wxPython.org/
369 AppSupportURL = http://wxPython.org/maillist.php
370 AppUpdatesURL = http://wxPython.org/download.php
371 AppVersion = %(VERSION)s
372
373 UninstallDisplayIcon = {app}\demo\wxpdemo.ico
374 UninstallFilesDir = {app}
375 LicenseFile = licence\licence.txt
376
377 ;; WizardDebug = yes
378
379
380 ;;------------------------------------------------------------
381
382
383 [Files]
384 Source: "demo\demo.py"; DestDir: "{app}\demo"; DestName: "demo.pyw";
385 Source: "demo\*.py"; DestDir: "{app}\demo";
386 Source: "demo\*.xml"; DestDir: "{app}\demo";
387 Source: "demo\*.txt"; DestDir: "{app}\demo";
388 Source: "demo\*.ico"; DestDir: "{app}\demo";
389
390 Source: "demo\bitmaps\*.bmp"; DestDir: "{app}\demo\bitmaps";
391 Source: "demo\bitmaps\*.gif"; DestDir: "{app}\demo\bitmaps";
392 Source: "demo\bitmaps\*.jpg"; DestDir: "{app}\demo\bitmaps";
393 Source: "demo\bitmaps\*.png"; DestDir: "{app}\demo\bitmaps";
394 Source: "demo\bitmaps\*.ico"; DestDir: "{app}\demo\bitmaps";
395
396 Source: "demo\bmp_source\*.gif"; DestDir: "{app}\demo\bmp_source";
397 Source: "demo\bmp_source\*.bmp"; DestDir: "{app}\demo\bmp_source";
398 Source: "demo\bmp_source\*.jpg"; DestDir: "{app}\demo\bmp_source";
399 Source: "demo\bmp_source\*.png"; DestDir: "{app}\demo\bmp_source";
400 Source: "demo\bmp_source\*.ico"; DestDir: "{app}\demo\bmp_source";
401
402 Source: "demo\data\*.htm"; DestDir: "{app}\demo\data";
403 Source: "demo\data\*.html"; DestDir: "{app}\demo\data";
404 Source: "demo\data\*.py"; DestDir: "{app}\demo\data";
405 Source: "demo\data\*.png"; DestDir: "{app}\demo\data";
406 Source: "demo\data\*.bmp"; DestDir: "{app}\demo\data";
407 Source: "demo\data\*.dat"; DestDir: "{app}\demo\data";
408 Source: "demo\data\*.txt"; DestDir: "{app}\demo\data";
409 Source: "demo\data\*.wav"; DestDir: "{app}\demo\data";
410 Source: "demo\data\*.wdr"; DestDir: "{app}\demo\data";
411 Source: "demo\data\*.xrc"; DestDir: "{app}\demo\data";
412 Source: "demo\data\*.swf"; DestDir: "{app}\demo\data";
413 Source: "demo\data\*.mpg"; DestDir: "{app}\demo\data";
414
415 ;;Source: "demo\dllwidget\*.cpp"; DestDir: "{app}\demo\dllwidget";
416 ;;Source: "demo\dllwidget\*.py"; DestDir: "{app}\demo\dllwidget";
417 ;;Source: "demo\dllwidget\Makefile"; DestDir: "{app}\demo\dllwidget";
418 ;;Source: "demo\dllwidget\makefile.*"; DestDir: "{app}\demo\dllwidget";
419
420 Source: "licence\*.txt"; DestDir: "{app}\docs\licence";
421 Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\docs";
422 ;;Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\docs";
423 Source: "docs\README.txt"; DestDir: "{app}\docs"; Flags: isreadme;
424 Source: "docs\*.txt"; DestDir: "{app}\docs";
425 Source: "docs\*.css"; DestDir: "{app}\docs";
426 Source: "docs\*.html"; DestDir: "{app}\docs";
427 Source: "docs\*.conf"; DestDir: "{app}\docs";
428 Source: "docs\screenshots\*.png"; DestDir: "{app}\docs\screenshots";
429
430
431 Source: "samples\doodle\*.py"; DestDir: "{app}\samples\doodle";
432 Source: "samples\doodle\*.txt"; DestDir: "{app}\samples\doodle";
433 Source: "samples\doodle\*.bat"; DestDir: "{app}\samples\doodle";
434 Source: "samples\doodle\sample.ddl"; DestDir: "{app}\samples\doodle";
435 Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\samples\doodle";
436
437 Source: "samples\docview\*.py"; DestDir: "{app}\samples\docview";
438 Source: "samples\pydocview\*.py"; DestDir: "{app}\samples\pydocview";
439 Source: "samples\pydocview\*.png"; DestDir: "{app}\samples\pydocview";
440 Source: "samples\pydocview\*.txt"; DestDir: "{app}\samples\pydocview";
441
442 Source: "samples\ide\*.py"; DestDir: "{app}\samples\ide";
443 Source: "samples\ide\activegrid\*.py"; DestDir: "{app}\samples\ide\activegrid";
444 Source: "samples\ide\activegrid\tool\*.py"; DestDir: "{app}\samples\ide\activegrid\tool";
445 Source: "samples\ide\activegrid\tool\data\*.txt"; DestDir: "{app}\samples\ide\activegrid\tool\data";
446 Source: "samples\ide\activegrid\util\*.py"; DestDir: "{app}\samples\ide\activegrid\util";
447 Source: "samples\ide\activegrid\model\*.py"; DestDir: "{app}\samples\ide\activegrid\model";
448
449 Source: "samples\embedded\*.py"; DestDir: "{app}\samples\embedded";
450 Source: "samples\embedded\*.cpp"; DestDir: "{app}\samples\embedded";
451 Source: "samples\embedded\*.txt"; DestDir: "{app}\samples\embedded";
452 Source: "samples\embedded\*.vc"; DestDir: "{app}\samples\embedded";
453 Source: "samples\embedded\*.unx"; DestDir: "{app}\samples\embedded";
454 Source: "samples\embedded\*.ico"; DestDir: "{app}\samples\embedded";
455 Source: "samples\embedded\*.xpm"; DestDir: "{app}\samples\embedded";
456 Source: "samples\embedded\*.rc"; DestDir: "{app}\samples\embedded";
457
458 Source: "samples\frogedit\*.py"; DestDir: "{app}\samples\frogedit";
459
460 Source: "samples\hangman\*.py"; DestDir: "{app}\samples\hangman";
461
462 Source: "samples\mainloop\*.py"; DestDir: "{app}\samples\mainloop";
463
464 Source: "samples\pySketch\*.py"; DestDir: "{app}\samples\pySketch";
465 Source: "samples\pySketch\images\*.bmp"; DestDir: "{app}\samples\pySketch\images";
466
467 Source: "samples\simple\*.py"; DestDir: "{app}\samples\simple";
468
469 Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\samples\StyleEditor";
470 Source: "samples\StyleEditor\*.py"; DestDir: "{app}\samples\StyleEditor";
471 Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\samples\StyleEditor";
472
473 Source: "samples\wxProject\*.txt"; DestDir: "{app}\samples\wxProject";
474 Source: "samples\wxProject\*.py"; DestDir: "{app}\samples\wxProject";
475
476 Source: "wxPython\samples\wxPIA_book\*"; DestDir: "{app}\wxPython\samples\wxPIA_book";
477 Source: "wxPython\samples\wxPIA_book\Chapter-01\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-01";
478 Source: "wxPython\samples\wxPIA_book\Chapter-02\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-02";
479 Source: "wxPython\samples\wxPIA_book\Chapter-03\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-03";
480 Source: "wxPython\samples\wxPIA_book\Chapter-04\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-04";
481 Source: "wxPython\samples\wxPIA_book\Chapter-05\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-05";
482 Source: "wxPython\samples\wxPIA_book\Chapter-06\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-06";
483 Source: "wxPython\samples\wxPIA_book\Chapter-07\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-07";
484 Source: "wxPython\samples\wxPIA_book\Chapter-08\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-08";
485 Source: "wxPython\samples\wxPIA_book\Chapter-09\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-09";
486 Source: "wxPython\samples\wxPIA_book\Chapter-10\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-10";
487 Source: "wxPython\samples\wxPIA_book\Chapter-11\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-11";
488 Source: "wxPython\samples\wxPIA_book\Chapter-12\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-12";
489 Source: "wxPython\samples\wxPIA_book\Chapter-13\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-13";
490 Source: "wxPython\samples\wxPIA_book\Chapter-14\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-14";
491 Source: "wxPython\samples\wxPIA_book\Chapter-15\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-15";
492 Source: "wxPython\samples\wxPIA_book\Chapter-16\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-16";
493 Source: "wxPython\samples\wxPIA_book\Chapter-16\helpfiles\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-16\helpfiles";
494 Source: "wxPython\samples\wxPIA_book\Chapter-17\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-17";
495 Source: "wxPython\samples\wxPIA_book\Chapter-18\*"; DestDir: "{app}\wxPython\samples\wxPIA_book\Chapter-18";
496
497
498 Source: "scripts\pyshell"; DestDir: "{app}\scripts"; DestName: "pyshell.pyw";
499 Source: "scripts\pycrust"; DestDir: "{app}\scripts"; DestName: "pycrust.pyw";
500 Source: "scripts\pyalamode"; DestDir: "{app}\scripts"; DestName: "pyalamode.pyw";
501 Source: "scripts\pyalacarte"; DestDir: "{app}\scripts"; DestName: "pyalacarte.pyw";
502 Source: "scripts\xrced"; DestDir: "{app}\scripts"; DestName: "xrced.pyw";
503
504 Source: "wx\py\PyCrust.ico"; DestDir: "{app}\scripts";
505 Source: "wx\tools\XRCed\xrced.ico"; DestDir: "{app}\scripts";
506
507
508 ;;------------------------------------------------------------
509
510 [Icons]
511 Name: "{group}\Run the wxPython DEMO"; Filename: "{app}\demo\demo.pyw"; WorkingDir: "{app}\demo"; IconFilename: "{app}\demo\wxpdemo.ico";
512 Name: "{group}\PyCrust"; Filename: "{app}\scripts\pycrust.pyw"; WorkingDir: "c:\"; IconFilename: "{app}\scripts\PyCrust.ico";
513 Name: "{group}\PyShell"; Filename: "{app}\scripts\pyshell.pyw"; WorkingDir: "c:\"; IconFilename: "{app}\scripts\PyCrust.ico";
514 Name: "{group}\PyAlaMode"; Filename: "{app}\scripts\pyalamode.pyw"; WorkingDir: "c:\"; IconFilename: "{app}\scripts\PyCrust.ico";
515 Name: "{group}\PyAlaCarte"; Filename: "{app}\scripts\pyalacarte.pyw"; WorkingDir: "c:\"; IconFilename: "{app}\scripts\PyCrust.ico";
516 Name: "{group}\Resource Editor"; Filename: "{app}\scripts\xrced.pyw"; WorkingDir: "c:\"; IconFilename: "{app}\scripts\xrced.ico";
517
518 Name: "{group}\Sample Apps"; Filename: "{app}\samples";
519
520 Name: "{group}\wxWidgets Reference"; Filename: "{app}\docs\wx.chm";
521 Name: "{group}\Migration Guide"; Filename: "{app}\docs\MigrationGuide.html";
522 Name: "{group}\Recent Changes"; Filename: "{app}\docs\CHANGES.html";
523 Name: "{group}\Other Docs"; Filename: "{app}\docs";
524
525 Name: "{group}\Uninstall wxPython Docs and Demos"; Filename: "{uninstallexe}";
526
527
528
529
530 ;;------------------------------------------------------------
531
532 [UninstallDelete]
533 Type: files; Name: "{app}\demo\*.pyc";
534 Type: files; Name: "{app}\demo\*.pyo";
535 Type: files; Name: "{app}\demo\data\showTips";
536 Type: files; Name: "{app}\demo\data\*.pyc";
537 Type: files; Name: "{app}\demo\data\*.pyo";
538 Type: files; Name: "{app}\demo\dllwidget\*.pyc";
539 Type: files; Name: "{app}\demo\dllwidget\*.pyo";
540
541 Type: files; Name: "{app}\samples\doodle\*.pyc";
542 Type: files; Name: "{app}\samples\doodle\*.pyo";
543 Type: files; Name: "{app}\samples\embedded\*.pyc";
544 Type: files; Name: "{app}\samples\embedded\*.pyo";
545 Type: files; Name: "{app}\samples\frogedit\*.pyc";
546 Type: files; Name: "{app}\samples\frogedit\*.pyo";
547 Type: files; Name: "{app}\samples\hangman\*.pyc";
548 Type: files; Name: "{app}\samples\hangman\*.pyo";
549 Type: files; Name: "{app}\samples\hangman\*.txt";
550 Type: files; Name: "{app}\samples\mainloop\*.pyc";
551 Type: files; Name: "{app}\samples\mainloop\*.pyo";
552 Type: files; Name: "{app}\samples\pySketch\*.pyc";
553 Type: files; Name: "{app}\samples\pySketch\*.pyo";
554 Type: files; Name: "{app}\samples\simple\*.pyc";
555 Type: files; Name: "{app}\samples\simple\*.pyo";
556 Type: files; Name: "{app}\samples\StyleEditor\*.pyc";
557 Type: files; Name: "{app}\samples\StyleEditor\*.pyo";
558 Type: files; Name: "{app}\samples\wx_examples\basic\*.pyc";
559 Type: files; Name: "{app}\samples\wx_examples\basic\*.pyo";
560 Type: files; Name: "{app}\samples\wx_examples\hello\*.pyc";
561 Type: files; Name: "{app}\samples\wx_examples\hello\*.pyo";
562 Type: files; Name: "{app}\samples\wxProject\*.pyc";
563 Type: files; Name: "{app}\samples\wxProject\*.pyo";
564
565 Type: files; Name: "{app}\samples\ide\*.pyc";
566 Type: files; Name: "{app}\samples\ide\activegrid\*.pyc";
567 Type: files; Name: "{app}\samples\ide\activegrid\tool\*.pyc";
568 Type: files; Name: "{app}\samples\ide\activegrid\util\*.pyc";
569 Type: files; Name: "{app}\samples\ide\activegrid\model\*.pyc";
570 Type: files; Name: "{app}\samples\ide\*.pyo";
571 Type: files; Name: "{app}\samples\ide\activegrid\*.pyo";
572 Type: files; Name: "{app}\samples\ide\activegrid\tool\*.pyo";
573 Type: files; Name: "{app}\samples\ide\activegrid\util\*.pyo";
574 Type: files; Name: "{app}\samples\ide\activegrid\model\*.pyo";
575
576 Type: files; Name: "{app}\samples\docview\*.pyc";
577 Type: files; Name: "{app}\samples\pydocview\*.pyc";
578 Type: files; Name: "{app}\samples\docview\*.pyo";
579 Type: files; Name: "{app}\samples\pydocview\*.pyo";
580
581 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\*";
582 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-01\*";
583 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-02\*";
584 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-03\*";
585 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-04\*";
586 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-05\*";
587 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-06\*";
588 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-07\*";
589 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-08\*";
590 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-09\*";
591 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-10\*";
592 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-11\*";
593 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-12\*";
594 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-13\*";
595 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-14\*";
596 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-15\*";
597 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-16\*";
598 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-16\helpfiles\*";
599 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-17\*";
600 Type: files; Name: "{app}\wxPython\samples\wxPIA_book\Chapter-18\*";
601
602
603 '''
604
605 #----------------------------------------------------------------------
606
607 def find_DLLs():
608
609 WXDLLVER = PYTHONVER = None
610
611 proc = os.popen(r"dumpbin /imports wx\_core_.pyd", "r")
612 lines = proc.readlines()
613 proc.close()
614 for line in lines:
615 if line.startswith(" wxmsw"):
616 WXDLLVER = line[9:14].split('_')[0]
617
618 if line.startswith(" python"):
619 PYTHONVER = line[10] + '.' + line[11]
620
621 return WXDLLVER, PYTHONVER
622
623
624 #----------------------------------------------------------------------
625
626 locale_template = 'Source: "%s"; DestDir: "{app}\%s\%s"; Components: core'
627
628 def build_locale_string(pkgdir):
629 stringlst = []
630
631 def walk_helper(lst, dirname, files):
632 for f in files:
633 filename = os.path.join(dirname, f)
634 if not os.path.isdir(filename):
635 lst.append( locale_template % (filename, pkgdir, dirname) )
636
637 os.path.walk('wx\\locale', walk_helper, stringlst)
638 return '\n'.join(stringlst)
639
640
641 def get_system_dir():
642 for p in [r"C:\WINNT\SYSTEM32",
643 r"C:\WINDOWS\SYSTEM32",
644 ]:
645 if os.path.exists(p):
646 return p
647 raise IOError, "System dir not found"
648
649
650 def get_batch_files():
651 globs = {}
652 execfile("scripts/CreateBatchFiles.py", globs)
653 scripts = globs["scripts"]
654 scripts = ['Type: files; Name: "{code:GetPythonDir}\Scripts\%s.bat";' % i[0] for i in scripts]
655 return '\n'.join(scripts)
656
657
658 runtime_template = 'Source: "%s"; DestDir: "{code:GetPythonDir}"; Flags: uninsneveruninstall; Components: core'
659
660 def get_runtime_dlls(PYVER):
661 if PYVER >= "py24":
662 source = [ r"distrib\msw\msvcr71.dll",
663 r"distrib\msw\msvcp71.dll" ]
664 else:
665 source = [ r"distrib\msw\MSVCRT.dll",
666 r"distrib\msw\MSVCIRT.dll",
667 r"distrib\msw\MSVCP60.dll" ]
668 DLLs = [runtime_template % dll for dll in source]
669 return '\n'.join(DLLs)
670
671
672 #----------------------------------------------------------------------
673
674 def main():
675
676 verglob = {}
677 execfile("wx/__version__.py", verglob)
678
679 VERSION = verglob["VERSION_STRING"]
680 SHORTVER = VERSION[:3]
681
682 WXDLLVER, PYTHONVER = find_DLLs()
683
684 PYVER = "py" + PYTHONVER[0] + PYTHONVER[2]
685 WXDIR = os.environ["WXWIN"]
686 WXPYDIR = os.path.join(WXDIR, "wxPython")
687 SYSDIR = get_system_dir()
688 ISSFILE = "__wxPython.iss"
689 ISSDEMOFILE = "__wxPythonDemo.iss"
690 UNINSTALL_BATCH = get_batch_files()
691 PKGDIR = open('src/wx.pth').read()
692 LOCALE = build_locale_string(PKGDIR)
693 RTDLL = get_runtime_dlls(PYVER)
694
695 print """Building Win32 installer for wxPython:
696 VERSION = %(VERSION)s
697 SHORTVER = %(SHORTVER)s
698 WXDLLVER = %(WXDLLVER)s
699 PYTHONVER = %(PYTHONVER)s
700 PYVER = %(PYVER)s
701 PKGDIR = %(PKGDIR)s
702 WXDIR = %(WXDIR)s
703 WXPYDIR = %(WXPYDIR)s
704 SYSDIR = %(SYSDIR)s
705 """ % vars()
706
707 if PYTHONVER >= "2.2":
708 IF22 = r"InstallDir := InstallDir + '\Lib\site-packages';"
709 else:
710 IF22 = ""
711
712 # Starting with 2.3.3 the hybrid build is the release build too, so
713 # no need to label it that way.
714 ##if WXDLL.find("h") != -1:
715 ## PYVER = PYVER + "-hybrid"
716
717 MSLU=''
718 CHARTYPE='ansi'
719 if "UNICODE=1" in sys.argv:
720 MSLU=r'Source: "distrib\msw\unicows.dll"; DestDir: "{code:GetPythonDir}"; Components: core' % vars()
721 CHARTYPE='unicode'
722
723 f = open(ISSFILE, "w")
724 f.write(ISS_Template % vars())
725 f.close()
726
727 f = open(ISSDEMOFILE, "w")
728 f.write(ISS_DocDemo_Template % vars())
729 f.close()
730
731 TOOLS = os.environ['TOOLS']
732 if TOOLS.startswith('/cygdrive'):
733 TOOLS = r"c:\TOOLS" # temporary hack until I convert everything over to bash
734
735 os.system(ISCC % (TOOLS, ISSFILE))
736 os.system(ISCC % (TOOLS, ISSDEMOFILE))
737
738 if not KEEP_TEMPS:
739 time.sleep(1)
740 os.remove(ISSFILE)
741 os.remove(ISSDEMOFILE)
742
743
744 #----------------------------------------------------------------------
745
746 if __name__ == "__main__":
747 main()
748
749
750
751 #----------------------------------------------------------------------
752
753