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