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