]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/make_installer.py
Bug fix from Mike Fletcher
[wxWidgets.git] / wxPython / distrib / make_installer.py
1 """
2
3 This script will generate a setup script for InnoSetup and then run it
4 to make the installer executable. If all goes right the proper versions
5 of Python and wxWindows (including hybrid/final settings) will all be
6 calculated based on what wxc.pyd imports and an appropriate installer
7 will be created.
8 """
9
10
11 import os, string
12
13 #----------------------------------------------------------------------
14
15 KEEP_TEMPS = 0
16
17 #----------------------------------------------------------------------
18
19 ISS_Template = r'''
20 ;;------------------------------------------------------------
21
22 [Setup]
23 AppName = wxPython
24 AppVerName = wxPython %(VERSION)s
25 OutputBaseFilename = wxPython-%(VERSION)s-%(PYVER)s
26 AppCopyright = Copyright © 2001 Total Control Software
27 DefaultDirName = {code:GetPythonDir|c:\DoNotInstallHere}
28 DefaultGroupName = wxPython %(SHORTVER)s for Python %(PYTHONVER)s
29 AlwaysCreateUninstallIcon = yes
30
31 ;; SourceDir = .
32 ;; OutputDir is relative to SourceDir
33 OutputDir = dist
34 WizardStyle = modern
35 UninstallStyle = modern
36 DisableStartupPrompt = true
37 CompressLevel = 9
38 DirExistsWarning = no
39 DisableReadyMemo = true
40 DisableReadyPage = true
41 ;;DisableDirPage = true
42 DisableProgramGroupPage = true
43 DisableAppendDir = true
44
45 UninstallFilesDir = {app}\wxPython
46 AppPublisherURL = http://wxPython.org/
47 LicenseFile = licence\licence.txt
48 CodeFile = %(IFSFILE)s
49
50 ;;------------------------------------------------------------
51
52 ;;[Dirs]
53 ;;Name: "{app}\"
54
55 ;;------------------------------------------------------------
56
57 [Components]
58 Name: core; Description: "wxPython modules and library"; Types: full compact custom; Flags: fixed
59 Name: docs; Description: "Documentation"; Types: full
60 Name: demo; Description: "Demo application"; Types: full
61 Name: samples; Description: "Sample applications"; Types: full
62 Name: tools; Description: "Tools"; Types: full
63
64
65 ;;------------------------------------------------------------
66
67 [Files]
68 Source: "%(SYSDIR)s\MSVCRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall; Components: core
69 Source: "%(SYSDIR)s\MSVCIRT.dll"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: sharedfile uninsneveruninstall; Components: core
70
71 Source: "%(WXDIR)s\lib\%(WXDLL)s"; DestDir: "{app}\wxPython"; Components: core
72 Source: "wxPython\wxc.pyd"; DestDir: "{app}\wxPython"; Components: core
73 Source: "wxPython\gridc.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
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
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
105 Source: "README.txt"; DestDir: "{app}\wxPython\docs"; Flags: isreadme; Components: core
106 Source: "CHANGES.txt"; DestDir: "{app}\wxPython\docs"; Components: core
107 Source: "licence\*.txt"; DestDir: "{app}\wxPython\docs\licence"; Components: core
108 Source: "%(WXDIR)s\docs\htmlhelp\wx.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
109 Source: "%(WXDIR)s\docs\htmlhelp\ogl.chm"; DestDir: "{app}\wxPython\docs"; Components: docs
110
111 Source: "tools\*.py"; DestDir: "{app}\wxPython\tools"; Components: tools
112
113 Source: "samples\doodle\*.py"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
114 Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
115 Source: "samples\doodle\sample.ddl"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
116 Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
117 Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
118 Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
119
120 Source: "samples\stxview\*.py"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
121 Source: "samples\stxview\*.stx"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
122 Source: "samples\stxview\*.txt"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
123 Source: "samples\stxview\StructuredText\*.py"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
124
125
126 ;;------------------------------------------------------------
127
128 [Icons]
129 Name: "{group}\Run the DEMO"; Filename: "{code:GetPythonDir}\pythonw.exe"; WorkingDir: "{app}\wxPython\demo"; Parameters: "demo.py";
130 Name: "{group}\wxWindows Referece"; Filename: "{app}\wxPython\docs\wx.chm";
131 Name: "{group}\wxOGL Referece"; Filename: "{app}\wxPython\docs\ogl.chm";
132 Name: "{group}\licence.txt"; Filename: "{app}\wxPython\docs\licence\licence.txt";
133 Name: "{group}\README.txt"; Filename: "{app}\wxPython\docs\README.txt";
134 Name: "{group}\CHANGES.txt"; Filename: "{app}\wxPython\docs\CHANGES.txt";
135 Name: "{group}\Sample Apps"; Filename: "{app}\wxPython\samples"; Components: samples
136
137 ;;Name: "{group}\Uninstall wxPython"; Filename: "{app}\wxPython\unins000.exe"; WorkingDir: "{app}\wxPython";
138
139
140 ;;------------------------------------------------------------
141
142 [UninstallDelete]
143 Type: files; Name: "{app}\wxPython\*.pyc";
144 Type: files; Name: "{app}\wxPython\*.pyo";
145 Type: files; Name: "{app}\wxPython\lib\*.pyc";
146 Type: files; Name: "{app}\wxPython\lib\*.pyo";
147 Type: files; Name: "{app}\wxPython\lib\editor\*.pyc";
148 Type: files; Name: "{app}\wxPython\lib\editor\*.pyo";
149 Type: files; Name: "{app}\wxPython\demo\*.pyc";
150 Type: files; Name: "{app}\wxPython\demo\*.pyo";
151 Type: files; Name: "{app}\wxPython\demo\data\showTips";
152 Type: files; Name: "{app}\wxPython\tools\*.pyc";
153 Type: files; Name: "{app}\wxPython\tools\*.pyo";
154 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyc";
155 Type: files; Name: "{app}\wxPython\samples\doodle\*.pyo";
156 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyc";
157 Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyo";
158 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyc";
159 Type: files; Name: "{app}\wxPython\samples\stxview\*.pyo";
160 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyc";
161 Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyo";
162
163 '''
164
165
166 #----------------------------------------------------------------------
167
168 IFS_Template = r"""
169 program Setup;
170 var
171 PythonDir : String;
172
173 function InitializeSetup(): Boolean;
174 begin
175 if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
176 'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
177 '', PythonDir) then begin
178 MsgBox('No installation of Python %(PYTHONVER)s found. Aborting...',
179 mbConfirmation, MB_OK);
180 Result := false;
181 end else
182 Result := true;
183 end;
184
185
186 function GetPythonDir(Default: String): String;
187 begin
188 Result := PythonDir;
189 end;
190
191 begin
192 end.
193
194 """
195
196
197 #----------------------------------------------------------------------
198
199 def find_DLLs():
200
201 WXDLL = PYTHONVER = None
202
203 proc = os.popen(r"dumpbin /imports wxPython\wxc.pyd", "r")
204 lines = proc.readlines()
205 proc.close()
206 for line in lines:
207 if line[:6] == " wx":
208 WXDLL = string.strip(line)
209
210 if line[:10] == " python":
211 PYTHONVER = line[10] + '.' + line[11]
212
213 if WXDLL and PYTHONVER:
214 return WXDLL, PYTHONVER
215
216
217 #----------------------------------------------------------------------
218
219 def main():
220
221 verglob = {}
222 execfile("wxPython/__version__.py", verglob)
223
224 VERSION = verglob["ver"]
225 SHORTVER = VERSION[:3]
226
227 WXDLL, PYTHONVER = find_DLLs()
228
229 PYVER = "Py" + PYTHONVER[0] + PYTHONVER[2]
230 WXDIR = os.environ["WXWIN"]
231 WXPYDIR = os.path.join(WXDIR, "wxPython")
232 SYSDIR = r"C:\WINNT\SYSTEM32"
233 ISSFILE = "__wxPython.iss"
234 IFSFILE = "__wxPython.ifs"
235
236
237 if string.find(WXDLL, "h") != -1:
238 PYVER = PYVER + "-hybrid"
239
240 f = open(ISSFILE, "w")
241 f.write(ISS_Template % vars())
242 f.close()
243
244 f = open(IFSFILE, "w")
245 f.write(IFS_Template % vars())
246 f.close()
247
248 os.system(r"C:\TOOLS\InnoSetup2Ex\ISCC.exe %s" % ISSFILE)
249
250 if not KEEP_TEMPS:
251 os.remove(ISSFILE)
252 os.remove(IFSFILE)
253
254
255 #----------------------------------------------------------------------
256
257 if __name__ == "__main__":
258 main()
259
260
261
262 #----------------------------------------------------------------------
263
264