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