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