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