]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/make_installer.py
b7ed38f9a09b58bf49ed824341d29eab9bf9b59c
[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 = wxPython-%(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
71 Source: "%(WXDIR)s\lib\%(WXDLL)s"; DestDir: "{app}\wxPython"; Components: core
72 %(MSLU)s
73 Source: "wxPython\wxc.pyd"; DestDir: "{app}\wxPython"; Components: core
74 Source: "wxPython\wxc.pyd.manifest"; DestDir: "{app}\wxPython"; Components: core
75 Source: "wxPython\gridc.pyd"; DestDir: "{app}\wxPython"; Components: core
76 Source: "wxPython\helpc.pyd"; DestDir: "{app}\wxPython"; Components: core
77 Source: "wxPython\htmlc.pyd"; DestDir: "{app}\wxPython"; Components: core
78 Source: "wxPython\calendarc.pyd"; DestDir: "{app}\wxPython"; Components: core
79 Source: "wxPython\glcanvasc.pyd"; DestDir: "{app}\wxPython"; Components: core
80 Source: "wxPython\oglc.pyd"; DestDir: "{app}\wxPython"; Components: core
81 Source: "wxPython\stc_c.pyd"; DestDir: "{app}\wxPython"; Components: core
82 Source: "wxPython\xrcc.pyd"; DestDir: "{app}\wxPython"; Components: core
83 Source: "wxPython\gizmosc.pyd"; DestDir: "{app}\wxPython"; Components: core
84 Source: "wxPython\iewinc.pyd"; DestDir: "{app}\wxPython"; Components: core
85 Source: "wxPython\dllwidget_c.pyd"; DestDir: "{app}\wxPython"; Components: core
86
87 Source: "wxPython\*.py"; DestDir: "{app}\wxPython"; Components: core
88 Source: "wxPython\lib\*.py"; DestDir: "{app}\wxPython\lib"; Components: core
89 Source: "wxPython\lib\*.wdr"; DestDir: "{app}\wxPython\lib"; Components: core
90 Source: "wxPython\lib\editor\*.py"; DestDir: "{app}\wxPython\lib\editor"; Components: core
91 Source: "wxPython\lib\editor\*.txt"; DestDir: "{app}\wxPython\lib\editor"; Components: core
92 Source: "wxPython\lib\mixins\*.py"; DestDir: "{app}\wxPython\lib\mixins"; Components: core
93 Source: "wxPython\lib\PyCrust\*.py"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
94 Source: "wxPython\lib\PyCrust\*.txt"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
95 Source: "wxPython\lib\PyCrust\*.ico"; DestDir: "{app}\wxPython\lib\PyCrust"; Components: core
96
97 Source: "demo\*.py"; DestDir: "{app}\wxPython\demo"; Components: demo
98 Source: "demo\*.xml"; DestDir: "{app}\wxPython\demo"; Components: demo
99 Source: "demo\*.txt"; DestDir: "{app}\wxPython\demo"; Components: demo
100 Source: "demo\*.ico"; DestDir: "{app}\wxPython\demo"; Components: demo
101 Source: "demo\*.wdr"; DestDir: "{app}\wxPython\demo"; Components: demo
102
103 Source: "demo\bitmaps\*.gif"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
104 Source: "demo\bitmaps\*.bmp"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
105 Source: "demo\bitmaps\*.jpg"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
106 Source: "demo\bitmaps\*.png"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
107 Source: "demo\bitmaps\*.ico"; DestDir: "{app}\wxPython\demo\bitmaps"; Components: demo
108
109 Source: "demo\bmp_source\*.gif"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
110 Source: "demo\bmp_source\*.bmp"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
111 ;;Source: "demo\bmp_source\*.jpg"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
112 Source: "demo\bmp_source\*.png"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
113 Source: "demo\bmp_source\*.ico"; DestDir: "{app}\wxPython\demo\bmp_source"; Components: demo
114
115 Source: "demo\data\*.htm"; DestDir: "{app}\wxPython\demo\data"; Components: demo
116 Source: "demo\data\*.html"; DestDir: "{app}\wxPython\demo\data"; Components: demo
117 Source: "demo\data\*.py"; DestDir: "{app}\wxPython\demo\data"; Components: demo
118 Source: "demo\data\*.png"; DestDir: "{app}\wxPython\demo\data"; Components: demo
119 Source: "demo\data\*.bmp"; DestDir: "{app}\wxPython\demo\data"; Components: demo
120 Source: "demo\data\*.i"; DestDir: "{app}\wxPython\demo\data"; Components: demo
121 ;;Source: "demo\data\*.h"; DestDir: "{app}\wxPython\demo\data"; Components: demo
122 Source: "demo\data\*.txt"; DestDir: "{app}\wxPython\demo\data"; Components: demo
123 Source: "demo\data\*.wav"; DestDir: "{app}\wxPython\demo\data"; Components: demo
124 Source: "demo\data\*.wdr"; DestDir: "{app}\wxPython\demo\data"; Components: demo
125 Source: "demo\data\*.xrc"; DestDir: "{app}\wxPython\demo\data"; Components: demo
126 Source: "demo\data\*.gif"; DestDir: "{app}\wxPython\demo\data"; Components: demo
127
128 Source: "demo\dllwidget\*.cpp"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
129 Source: "demo\dllwidget\*.py"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
130 Source: "demo\dllwidget\Makefile"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
131 Source: "demo\dllwidget\makefile.*"; DestDir: "{app}\wxPython\demo\dllwidget"; Components: demo
132
133 Source: "README.txt"; DestDir: "{app}\wxPython\docs"; Flags: isreadme; Components: core
134 Source: "CHANGES.txt"; DestDir: "{app}\wxPython\docs"; Components: core
135 Source: "licence\*.txt"; DestDir: "{app}\wxPython\docs\licence"; Components: core
136 Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
137 Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
138
139 Source: "wxPython\tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: tools
140 Source: "wxPython\tools\XRCed\CHANGES"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
141 Source: "wxPython\tools\XRCed\TODO"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
142 Source: "wxPython\tools\XRCed\README"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
143 Source: "wxPython\tools\XRCed\*.py"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
144 Source: "wxPython\tools\XRCed\*.xrc"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
145 Source: "wxPython\tools\XRCed\*.ico"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
146 Source: "wxPython\tools\XRCed\*.sh"; DestDir: "{app}\wxPython\tools\XRCed"; Components: tools
147
148 ;; Where to put the scripts on Win32???
149
150 Source: "samples\doodle\*.py"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
151 Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
152 Source: "samples\doodle\sample.ddl"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
153 Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
154
155 Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
156 Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
157
158 Source: "samples\stxview\*.py"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
159 Source: "samples\stxview\*.stx"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
160 Source: "samples\stxview\*.txt"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
161 Source: "samples\stxview\StructuredText\*.py"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
162 Source: "samples\stxview\StructuredText\*.txt"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
163
164 Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
165 Source: "samples\StyleEditor\*.py"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
166 Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
167
168 Source: "samples\pySketch\*.py"; DestDir: "{app}\wxPython\samples\pySketch"; Components: samples
169 Source: "samples\pySketch\images\*.bmp"; DestDir: "{app}\wxPython\samples\pySketch\images"; Components: samples
170
171 Source: "samples\frogedit\*.py"; DestDir: "{app}\wxPython\samples\frogedit"; Components: samples
172
173 Source: "samples\embedded\*.py"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
174 Source: "samples\embedded\*.cpp"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
175 Source: "samples\embedded\*.txt"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
176 Source: "samples\embedded\*.vc"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
177 Source: "samples\embedded\*.unx"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
178 Source: "samples\embedded\*.ico"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
179 Source: "samples\embedded\*.xpm"; DestDir: "{app}\wxPython\samples\embedded"; Components: samples
180
181 ;;------------------------------------------------------------
182
183 [Icons]
184 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
185 Name: "{group}\PyCrust"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{app}\wxPython\lib\PyCrust\PyCrustApp.py"; IconFilename: "{app}\wxPython\lib\PyCrust\PyCrust.ico"; Components: core
186 Name: "{group}\wxWindows Reference"; Filename: "{app}\wxPython\docs\wx.chm"; Components: docs
187 Name: "{group}\wxOGL Reference"; Filename: "{app}\wxPython\docs\ogl.chm"; Components: docs
188 Name: "{group}\licence.txt"; Filename: "{app}\wxPython\docs\licence\licence.txt"; Components: core
189 Name: "{group}\README.txt"; Filename: "{app}\wxPython\docs\README.txt"; Components: core
190 Name: "{group}\CHANGES.txt"; Filename: "{app}\wxPython\docs\CHANGES.txt"; Components: core
191 Name: "{group}\Sample Apps"; Filename: "{app}\wxPython\samples"; Components: samples
192 Name: "{group}\Resource Editor"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "c:\"; Parameters: "{app}\wxPython\Tools\XRCed\xrced.py"; IconFilename: "{app}\wxPython\Tools\XRCed\xrced.ico"; Components: tools
193
194
195 ;;------------------------------------------------------------
196
197 [UninstallDelete]
198 Type: files; Name: "{app}\wxPython\*.pyc";
199 Type: files; Name: "{app}\wxPython\*.pyo";
200 Type: files; Name: "{app}\wxPython\*.pyd";
201 Type: files; Name: "{app}\wxPython\lib\*.pyc";
202 Type: files; Name: "{app}\wxPython\lib\*.pyo";
203 Type: files; Name: "{app}\wxPython\lib\editor\*.pyc";
204 Type: files; Name: "{app}\wxPython\lib\editor\*.pyo";
205 Type: files; Name: "{app}\wxPython\lib\mixins\*.pyc";
206 Type: files; Name: "{app}\wxPython\lib\mixins\*.pyo";
207 Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyc";
208 Type: files; Name: "{app}\wxPython\lib\PyCrust\*.pyo";
209 Type: files; Name: "{app}\wxPython\demo\*.pyc";
210 Type: files; Name: "{app}\wxPython\demo\*.pyo";
211 Type: files; Name: "{app}\wxPython\demo\data\showTips";
212 Type: files; Name: "{app}\wxPython\tools\*.pyc";
213 Type: files; Name: "{app}\wxPython\tools\*.pyo";
214 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyc";
215 Type: files; Name: "{app}\wxPython\tools\XRCed\*.pyo";
216 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyc";
217 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyo";
218 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyc";
219 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyo";
220 Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyc";
221 Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyo";
222 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyc";
223 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyo";
224 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyc";
225 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyo";
226 Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyc";
227 Type: files; Name: "{app}\wxPython\samples\frogedit\*.pyo";
228
229 '''
230
231
232 #----------------------------------------------------------------------
233
234
235 IFS_Template = r"""
236 program Setup;
237 var
238 PythonDir : String;
239 InstallDir : String;
240
241 function InitializeSetup(): Boolean;
242 begin
243 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
244 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
245 '', PythonDir) then begin
246
247 if not RegQueryStringValue(HKEY_CURRENT_USER,
248 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
249 '', PythonDir) then begin
250
251 MsgBox('No installation of Python %(PYTHONVER)s found in registry.\nBe sure to enter a pathname that places wxPython\non the PYTHONPATH',
252 mbConfirmation, MB_OK);
253 PythonDir := 'C:\Put a directory on PYTHONPATH here\';
254 end;
255 end;
256 InstallDir := PythonDir;
257 %(IF22)s
258 Result := true;
259 end;
260
261
262 function GetPythonDir(Default: String): String;
263 begin
264 Result := PythonDir;
265 end;
266
267 function GetInstallDir(Default: String): String;
268 begin
269 Result := InstallDir;
270 end;
271
272 begin
273 end.
274
275 """
276
277
278 #----------------------------------------------------------------------
279
280 def find_DLLs():
281
282 WXDLL = PYTHONVER = None
283
284 proc = os.popen(r"dumpbin /imports wxPython\wxc.pyd", "r")
285 lines = proc.readlines()
286 proc.close()
287 for line in lines:
288 if line[:6] == " wx":
289 WXDLL = string.strip(line)
290
291 if line[:10] == " python":
292 PYTHONVER = line[10] + '.' + line[11]
293
294 if WXDLL and PYTHONVER:
295 return WXDLL, PYTHONVER
296
297
298 #----------------------------------------------------------------------
299
300 def main():
301
302 verglob = {}
303 execfile("wxPython/__version__.py", verglob)
304
305 VERSION = verglob["ver"]
306 SHORTVER = VERSION[:3]
307
308 WXDLL, PYTHONVER = find_DLLs()
309
310 PYVER = "Py" + PYTHONVER[0] + PYTHONVER[2]
311 WXDIR = os.environ["WXWIN"]
312 WXPYDIR = os.path.join(WXDIR, "wxPython")
313 SYSDIR = r"C:\WINNT\SYSTEM32"
314 ISSFILE = "__wxPython.iss"
315 IFSFILE = "__wxPython.ifs"
316
317 if PYTHONVER >= "2.2":
318 IF22 = r"InstallDir := InstallDir + '\Lib\site-packages';"
319 else:
320 IF22 = ""
321
322 if string.find(WXDLL, "h") != -1:
323 PYVER = PYVER + "-hybrid"
324
325 MSLU=''
326 if len(sys.argv) > 1 and sys.argv[1] == "UNICODE=1":
327 MSLU=r'Source: "%(WXDIR)s\lib\unicows.dll"; DestDir: "{code:GetPythonDir}"; Components: core' % vars()
328
329 f = open(ISSFILE, "w")
330 f.write(ISS_Template % vars())
331 f.close()
332
333 f = open(IFSFILE, "w")
334 f.write(IFS_Template % vars())
335 f.close()
336
337 os.system(ISCC % (os.environ['TOOLS'], ISSFILE))
338
339 if not KEEP_TEMPS:
340 os.remove(ISSFILE)
341 os.remove(IFSFILE)
342
343
344 #----------------------------------------------------------------------
345
346 if __name__ == "__main__":
347 main()
348
349
350
351 #----------------------------------------------------------------------
352
353