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