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