]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/make_installer.py
Create an NSView (in leiu of a real static bitmap class)
[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 sys, os, string
11
12 KEEP_TEMPS = 0
13 ISCC = r"%s\InnoSetup2Ex\ISCC.exe %s"
14
15 #----------------------------------------------------------------------
16
17 ISS_Template = r'''
18 ;;------------------------------------------------------------
19
20 [Setup]
21 AppName = wxPython
22 AppVerName = wxPython %(VERSION)s for Python %(PYTHONVER)s
23 OutputBaseFilename = wxPythonWIN32-%(VERSION)s-%(PYVER)s
24 AppCopyright = Copyright © 2002 Total Control Software
25 DefaultDirName = {code:GetInstallDir|c:\DoNotInstallHere}
26 DefaultGroupName = wxPython %(SHORTVER)s for Python %(PYTHONVER)s
27 AlwaysCreateUninstallIcon = yes
28
29 ;; SourceDir = .
30 ;; OutputDir is relative to SourceDir
31 OutputDir = dist
32 WizardStyle = modern
33 UninstallStyle = modern
34 DisableStartupPrompt = true
35 CompressLevel = 9
36 DirExistsWarning = no
37 DisableReadyMemo = true
38 DisableReadyPage = true
39 ;;DisableDirPage = true
40 DisableProgramGroupPage = true
41 DisableAppendDir = true
42 UsePreviousAppDir = no
43 UsePreviousGroup = no
44
45 UninstallFilesDir = {app}\wxPython
46 AppPublisherURL = http://wxPython.org/
47 LicenseFile = licence\licence.txt
48 CodeFile = %(IFSFILE)s
49
50 ;;------------------------------------------------------------
51
52 ;;[Dirs]
53 ;;Name: "{app}\"
54
55 ;;------------------------------------------------------------
56
57 [Components]
58 Name: core; Description: "wxPython modules and library"; Types: full compact custom; Flags: fixed
59 Name: docs; Description: "Documentation"; Types: full
60 Name: demo; Description: "Demo application"; Types: full
61 Name: samples; Description: "Sample applications"; Types: full
62 Name: tools; Description: "Tools"; Types: full
63
64
65 ;;------------------------------------------------------------
66
67 [Files]
68 Source: "%(SYSDIR)s\MSVCRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall restartreplace; Components: core
69 Source: "%(SYSDIR)s\MSVCIRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall restartreplace; Components: core
70 Source: "%(SYSDIR)s\MSVCP60.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall restartreplace; Components: core
71
72 Source: "%(WXDIR)s\lib\%(WXDLL)s"; DestDir: "{app}\wxPython"; Components: core
73 %(MSLU)s
74 Source: "wxPython\wxc.pyd"; DestDir: "{app}\wxPython"; Components: core
75 Source: "wxPython\wxc.pyd.manifest"; DestDir: "{app}\wxPython"; Components: core
76 Source: "wxPython\gridc.pyd"; DestDir: "{app}\wxPython"; Components: core
77 Source: "wxPython\helpc.pyd"; DestDir: "{app}\wxPython"; Components: core
78 Source: "wxPython\htmlc.pyd"; DestDir: "{app}\wxPython"; Components: core
79 Source: "wxPython\calendarc.pyd"; DestDir: "{app}\wxPython"; Components: core
80 Source: "wxPython\wizardc.pyd"; DestDir: "{app}\wxPython"; Components: core
81 Source: "wxPython\glcanvasc.pyd"; DestDir: "{app}\wxPython"; Components: core
82 Source: "wxPython\oglc.pyd"; DestDir: "{app}\wxPython"; Components: core
83 Source: "wxPython\stc_c.pyd"; DestDir: "{app}\wxPython"; Components: core
84 Source: "wxPython\xrcc.pyd"; DestDir: "{app}\wxPython"; Components: core
85 Source: "wxPython\gizmosc.pyd"; DestDir: "{app}\wxPython"; Components: core
86 Source: "wxPython\iewinc.pyd"; DestDir: "{app}\wxPython"; Components: core
87 Source: "wxPython\dllwidget_c.pyd"; DestDir: "{app}\wxPython"; Components: core
88
89 Source: "wxPython\*.py"; DestDir: "{app}\wxPython"; Components: core
90 Source: "wxPython\lib\*.py"; DestDir: "{app}\wxPython\lib"; Components: core
91 Source: "wxPython\lib\*.wdr"; DestDir: "{app}\wxPython\lib"; Components: core
92 Source: "wxPython\lib\editor\*.py"; DestDir: "{app}\wxPython\lib\editor"; Components: core
93 Source: "wxPython\lib\editor\*.txt"; DestDir: "{app}\wxPython\lib\editor"; Components: core
94 Source: "wxPython\lib\mixins\*.py"; DestDir: "{app}\wxPython\lib\mixins"; Components: core
95 Source: "wxPython\lib\PyCrust\*.py"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
96 Source: "wxPython\lib\PyCrust\*.txt"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
97 Source: "wxPython\lib\PyCrust\*.ico"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
98
99 Source: "demo\*.py"; DestDir: "{app}\wxPython\demo"; Components: demo
100 Source: "demo\*.xml"; DestDir: "{app}\wxPython\demo"; Components: demo
101 Source: "demo\*.txt"; DestDir: "{app}\wxPython\demo"; Components: demo
102 Source: "demo\*.ico"; DestDir: "{app}\wxPython\demo"; Components: demo
103 Source: "demo\*.wdr"; DestDir: "{app}\wxPython\demo"; Components: demo
104
105 Source: "demo\bitmaps\*.gif"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
106 Source: "demo\bitmaps\*.bmp"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
107 Source: "demo\bitmaps\*.jpg"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
108 Source: "demo\bitmaps\*.png"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
109 Source: "demo\bitmaps\*.ico"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
110
111 Source: "demo\bmp_source\*.gif"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
112 Source: "demo\bmp_source\*.bmp"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
113 ;;Source: "demo\bmp_source\*.jpg"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
114 Source: "demo\bmp_source\*.png"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
115 Source: "demo\bmp_source\*.ico"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
116
117 Source: "demo\data\*.htm"; DestDir: "{app}\wxPython\demo\data"; Components: demo
118 Source: "demo\data\*.html"; DestDir: "{app}\wxPython\demo\data"; Components: demo
119 Source: "demo\data\*.py"; DestDir: "{app}\wxPython\demo\data"; Components: demo
120 Source: "demo\data\*.png"; DestDir: "{app}\wxPython\demo\data"; Components: demo
121 Source: "demo\data\*.bmp"; DestDir: "{app}\wxPython\demo\data"; Components: demo
122 Source: "demo\data\*.i"; DestDir: "{app}\wxPython\demo\data"; Components: demo
123 ;;Source: "demo\data\*.h"; DestDir: "{app}\wxPython\demo\data"; Components: demo
124 Source: "demo\data\*.txt"; DestDir: "{app}\wxPython\demo\data"; Components: demo
125 Source: "demo\data\*.wav"; DestDir: "{app}\wxPython\demo\data"; Components: demo
126 Source: "demo\data\*.wdr"; DestDir: "{app}\wxPython\demo\data"; Components: demo
127 Source: "demo\data\*.xrc"; DestDir: "{app}\wxPython\demo\data"; Components: demo
128 Source: "demo\data\*.gif"; DestDir: "{app}\wxPython\demo\data"; Components: demo
129
130 Source: "demo\dllwidget\*.cpp"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
131 Source: "demo\dllwidget\*.py"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
132 Source: "demo\dllwidget\Makefile"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
133 Source: "demo\dllwidget\makefile.*"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
134
135 Source: "README.txt"; DestDir: "{app}\wxPython\docs"; Flags: isreadme; Components: core
136 Source: "CHANGES.txt"; DestDir: "{app}\wxPython\docs"; Components: core
137 Source: "licence\*.txt"; DestDir: "{app}\wxPython\docs\licence"; Components: core
138 Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
139 Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
140
141 Source: "wxPython\tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: tools
142 Source: "wxPython\tools\XRCed\CHANGES"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
143 Source: "wxPython\tools\XRCed\TODO"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
144 Source: "wxPython\tools\XRCed\README"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
145 Source: "wxPython\tools\XRCed\*.py"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
146 Source: "wxPython\tools\XRCed\*.xrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
147 Source: "wxPython\tools\XRCed\*.ico"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
148 Source: "wxPython\tools\XRCed\*.sh"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
149
150 Source: "scripts\*.bat"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
151 Source: "scripts\*.py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
152 Source: "scripts\img2png"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
153 Source: "scripts\img2py"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
154 Source: "scripts\img2xpm"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
155 Source: "scripts\xrced"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
156 Source: "scripts\pyshell"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
157 Source: "scripts\pycrust"; DestDir: "{code:GetPythonDir}\Scripts"; Components: tools
158
159 Source: "samples\doodle\*.py"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
160 Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
161 Source: "samples\doodle\sample.ddl"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
162 Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
163
164 Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
165 Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
166
167 Source: "samples\stxview\*.py"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
168 Source: "samples\stxview\*.stx"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
169 Source: "samples\stxview\*.txt"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
170 Source: "samples\stxview\StructuredText\*.py"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
171 Source: "samples\stxview\StructuredText\*.txt"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
172
173 Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
174 Source: "samples\StyleEditor\*.py"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
175 Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
176
177 Source: "samples\pySketch\*.py"; DestDir: "{app}\wxPython\samples\pySketch"; Components: samples
178 Source: "samples\pySketch\images\*.bmp"; DestDir: "{app}\wxPython\samples\pySketch\images"; Components: samples
179
180 Source: "samples\frogedit\*.py"; DestDir: "{app}\wxPython\samples\frogedit"; Components: samples
181
182 Source: "samples\embedded\*.py"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
183 Source: "samples\embedded\*.cpp"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
184 Source: "samples\embedded\*.txt"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
185 Source: "samples\embedded\*.vc"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
186 Source: "samples\embedded\*.unx"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
187 Source: "samples\embedded\*.ico"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
188 Source: "samples\embedded\*.xpm"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
189
190 ;;------------------------------------------------------------
191
192 [Run]
193 ;; Recreate the tool scripts to use the paths on the users machine
194 Filename: "{code:GetPythonDir}\python.exe"; Parameters: "{code:GetPythonDir}\Lib\compileall.py {app}\wxPython"; Description: "Compile Python .py files to .pyc"; Flags: postinstall; Components: core
195 Filename: "{code:GetPythonDir}\python.exe"; Parameters: "CreateBatchFiles.py"; WorkingDir: "{code:GetPythonDir}\Scripts"; Description: "Create batch files for tool scripts"; Flags: postinstall; Components: tools
196
197
198 ;;------------------------------------------------------------
199
200 [Icons]
201 Name: "{group}\Run the DEMO"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "{app}\wxPython\demo"; Parameters: "demo.py"; IconFilename: "{app}\wxPython\demo\wxpdemo.ico"; Components: core
202 Name: "{group}\PyCrust"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pycrust"; IconFilename: "{app}\wxPython\lib\PyCrust\PyCrust.ico"; Components: core
203 Name: "{group}\PyShell"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\pyshell"; IconFilename: "{app}\wxPython\lib\PyCrust\PyCrust.ico"; Components: core
204 Name: "{group}\wxWindows Reference"; Filename: "{app}\wxPython\docs\wx.chm"; Components: docs
205 Name: "{group}\wxOGL Reference"; Filename: "{app}\wxPython\docs\ogl.chm"; Components: docs
206 Name: "{group}\licence.txt"; Filename: "{app}\wxPython\docs\licence\licence.txt"; Components: core
207 Name: "{group}\README.txt"; Filename: "{app}\wxPython\docs\README.txt"; Components: core
208 Name: "{group}\CHANGES.txt"; Filename: "{app}\wxPython\docs\CHANGES.txt"; Components: core
209 Name: "{group}\Sample Apps"; Filename: "{app}\wxPython\samples"; Components: samples
210 Name: "{group}\Resource Editor"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{code:GetPythonDir}\Scripts\xrced"; IconFilename: "{app}\wxPython\Tools\XRCed\xrced.ico"; Components: tools
211
212
213 ;;------------------------------------------------------------
214
215 [UninstallDelete]
216 Type: files; Name: "{app}\wxPython\*.pyc";
217 Type: files; Name: "{app}\wxPython\*.pyo";
218 Type: files; Name: "{app}\wxPython\*.pyd";
219 Type: files; Name: "{app}\wxPython\lib\*.pyc";
220 Type: files; Name: "{app}\wxPython\lib\*.pyo";
221 Type: files; Name: "{app}\wxPython\lib\editor\*.pyc";
222 Type: files; Name: "{app}\wxPython\lib\editor\*.pyo";
223 Type: files; Name: "{app}\wxPython\lib\mixins\*.pyc";
224 Type: files; Name: "{app}\wxPython\lib\mixins\*.pyo";
225 Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyc";
226 Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyo";
227 Type: files; Name: "{app}\wxPython\tools\*.pyc";
228 Type: files; Name: "{app}\wxPython\tools\*.pyo";
229 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyc";
230 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyo";
231 Type: files; Name: "{app}\wxPython\demo\*.pyc";
232 Type: files; Name: "{app}\wxPython\demo\*.pyo";
233 Type: files; Name: "{app}\wxPython\demo\data\showTips";
234 Type: files; Name: "{app}\wxPython\tools\*.pyc";
235 Type: files; Name: "{app}\wxPython\tools\*.pyo";
236 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyc";
237 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyo";
238 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyc";
239 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyo";
240 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyc";
241 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyo";
242 Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyc";
243 Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyo";
244 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyc";
245 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyo";
246 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyc";
247 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyo";
248 Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyc";
249 Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyo";
250 Type: files; Name: "{app}\wxPython\demo\data\*.pyc";
251 Type: files; Name: "{app}\wxPython\demo\data\*.pyo";
252 Type: files; Name: "{app}\wxPython\demo\dllwidget\*.pyc";
253 Type: files; Name: "{app}\wxPython\demo\dllwidget\*.pyo";
254 Type: files; Name: "{app}\wxPython\samples\embedded\*.pyc";
255 Type: files; Name: "{app}\wxPython\samples\embedded\*.pyo";
256 Type: files; Name: "{app}\wxPython\samples\pySketch\*.pyc";
257 Type: files; Name: "{app}\wxPython\samples\pySketch\*.pyo";
258
259
260 '''
261
262
263 #----------------------------------------------------------------------
264
265
266 IFS_Template = r"""
267 program Setup;
268 var
269 PythonDir : String;
270 InstallDir : String;
271
272 function InitializeSetup(): Boolean;
273 begin
274 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
275 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
276 '', PythonDir) then begin
277
278 if not RegQueryStringValue(HKEY_CURRENT_USER,
279 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
280 '', PythonDir) then begin
281
282 MsgBox('No installation of Python %(PYTHONVER)s found in registry.\nBe sure to enter a pathname that places wxPython\non the PYTHONPATH',
283 mbConfirmation, MB_OK);
284 PythonDir := 'C:\Put a directory on PYTHONPATH here\';
285 end;
286 end;
287 InstallDir := PythonDir;
288 %(IF22)s
289 Result := true;
290 end;
291
292
293 function GetPythonDir(Default: String): String;
294 begin
295 Result := PythonDir;
296 end;
297
298 function GetInstallDir(Default: String): String;
299 begin
300 Result := InstallDir;
301 end;
302
303 begin
304 end.
305
306 """
307
308
309 #----------------------------------------------------------------------
310
311 def find_DLLs():
312
313 WXDLL = PYTHONVER = None
314
315 proc = os.popen(r"dumpbin /imports wxPython\wxc.pyd", "r")
316 lines = proc.readlines()
317 proc.close()
318 for line in lines:
319 if line[:6] == " wx":
320 WXDLL = string.strip(line)
321
322 if line[:10] == " python":
323 PYTHONVER = line[10] + '.' + line[11]
324
325 if WXDLL and PYTHONVER:
326 return WXDLL, PYTHONVER
327
328
329 #----------------------------------------------------------------------
330
331 def main():
332
333 verglob = {}
334 execfile("wxPython/__version__.py", verglob)
335
336 VERSION = verglob["ver"]
337 SHORTVER = VERSION[:3]
338
339 WXDLL, PYTHONVER = find_DLLs()
340
341 PYVER = "Py" + PYTHONVER[0] + PYTHONVER[2]
342 WXDIR = os.environ["WXWIN"]
343 WXPYDIR = os.path.join(WXDIR, "wxPython")
344 SYSDIR = r"C:\WINNT\SYSTEM32"
345 ISSFILE = "__wxPython.iss"
346 IFSFILE = "__wxPython.ifs"
347
348 if PYTHONVER >= "2.2":
349 IF22 = r"InstallDir := InstallDir + '\Lib\site-packages';"
350 else:
351 IF22 = ""
352
353 # Starting with 2.3.3 the hybrid build is the release build too, so
354 # no need to label it that way.
355 ##if string.find(WXDLL, "h") != -1:
356 ## PYVER = PYVER + "-hybrid"
357
358 MSLU=''
359 if len(sys.argv) > 1 and sys.argv[1] == "UNICODE=1":
360 MSLU=r'Source: "%(WXDIR)s\lib\unicows.dll"; DestDir: "{code:GetPythonDir}"; Components: core' % vars()
361
362 f = open(ISSFILE, "w")
363 f.write(ISS_Template % vars())
364 f.close()
365
366 f = open(IFSFILE, "w")
367 f.write(IFS_Template % vars())
368 f.close()
369
370 os.system(ISCC % (os.environ['TOOLS'], ISSFILE))
371
372 if not KEEP_TEMPS:
373 os.remove(ISSFILE)
374 os.remove(IFSFILE)
375
376
377 #----------------------------------------------------------------------
378
379 if __name__ == "__main__":
380 main()
381
382
383
384 #----------------------------------------------------------------------
385
386