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