]>
Commit | Line | Data |
---|---|---|
c368d904 RD |
1 | #!/usr/bin/env python |
2 | #---------------------------------------------------------------------- | |
1128a89b RD |
3 | # Name: setup.py |
4 | # Purpose: Distutils script for building wxPython | |
5 | # | |
6 | # Author: Robin Dunn | |
7 | # | |
8 | # Created: 12-Oct-2000 | |
9 | # RCS-ID: $Id$ | |
10 | # Copyright: (c) 2000 by Total Control Software | |
11 | # Licence: wxWindows license | |
1e4a197e RD |
12 | #---------------------------------------------------------------------- |
13 | ||
1128a89b | 14 | import sys |
e6056257 | 15 | |
e6056257 | 16 | |
1128a89b RD |
17 | # The full contents of the wx.build.config module used to be located |
18 | # here in setup.py. They were split into a separate module so it will | |
19 | # be installed with wxPython and can then be used by the build scripts | |
20 | # of other extension modules that wich to be wxPython compatible. The | |
21 | # split is still fairly new and hasn't been tested by building | |
22 | # third-party extensions yet, so expect some things to still shift | |
23 | # back and forth, and also more stuff in config.py will get converted | |
24 | # to functions, etc. | |
e6056257 | 25 | |
8f8c4b40 RD |
26 | # This script imports it as just "config" because if wxPython doesn't |
27 | # exist yet, then it can't be imported from wx.build.config (since | |
28 | # wx._core doesn't exist yet.) So instead we keep the main copy of | |
29 | # config .py in the same place as setup.py, and then copy it to | |
30 | # wx/build as needed below. | |
31 | ||
1128a89b | 32 | sys.setup_is_main = __name__ == "__main__" # an icky hack! |
8f8c4b40 RD |
33 | from config import * |
34 | ||
35 | ||
36 | #---------------------------------------------------------------------- | |
37 | # Update the packaged config file. | |
38 | #---------------------------------------------------------------------- | |
c368d904 | 39 | |
8f8c4b40 RD |
40 | copy_file('config.py', 'wx/build', update=1, verbose=1) |
41 | CLEANUP.append('wx/build/config.py') | |
c368d904 | 42 | |
c368d904 | 43 | #---------------------------------------------------------------------- |
1fded56b | 44 | # Update the version file |
c368d904 RD |
45 | #---------------------------------------------------------------------- |
46 | ||
1128a89b RD |
47 | # The version file is unconditionally updated every time setup.py is |
48 | # run since the version string can change based on the UNICODE flag | |
49 | ||
e83135b2 | 50 | open('wx/__version__.py', 'w').write("""\ |
1fded56b RD |
51 | # This file was generated by setup.py... |
52 | ||
d14a1e28 RD |
53 | VERSION_STRING = '%(VERSION)s' |
54 | MAJOR_VERSION = %(VER_MAJOR)s | |
55 | MINOR_VERSION = %(VER_MINOR)s | |
56 | RELEASE_VERSION = %(VER_RELEASE)s | |
57 | SUBREL_VERSION = %(VER_SUBREL)s | |
1fded56b | 58 | |
d14a1e28 | 59 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, |
e83135b2 | 60 | SUBREL_VERSION, '%(VER_FLAGS)s') |
1fded56b | 61 | |
d14a1e28 | 62 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility |
1fded56b | 63 | """ % globals()) |
1e4a197e | 64 | |
99abd512 | 65 | CLEANUP.append('wx/__version__.py') |
c368d904 | 66 | |
1b62f00d | 67 | |
1b62f00d RD |
68 | #---------------------------------------------------------------------- |
69 | # Define the CORE extension module | |
70 | #---------------------------------------------------------------------- | |
71 | ||
1e4a197e | 72 | msg('Preparing CORE...') |
d14a1e28 RD |
73 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, |
74 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1e0c8722 RD |
75 | [ 'src/_accel.i', |
76 | 'src/_app.i', | |
d14a1e28 RD |
77 | 'src/_app_ex.py', |
78 | 'src/_constraints.i', | |
79 | 'src/_core_api.i', | |
80 | 'src/_core_ex.py', | |
54f9ee45 RD |
81 | 'src/__core_rename.i', |
82 | 'src/__core_reverse.txt', | |
d14a1e28 RD |
83 | 'src/_defs.i', |
84 | 'src/_event.i', | |
85 | 'src/_event_ex.py', | |
38b97c15 | 86 | 'src/_evtloop.i', |
d14a1e28 RD |
87 | 'src/_evthandler.i', |
88 | 'src/_filesys.i', | |
89 | 'src/_gdicmn.i', | |
90 | 'src/_image.i', | |
91 | 'src/_menu.i', | |
92 | 'src/_obj.i', | |
93 | 'src/_sizers.i', | |
94 | 'src/_gbsizer.i', | |
95 | 'src/_streams.i', | |
96 | 'src/_validator.i', | |
97 | 'src/_window.i', | |
99abd512 | 98 | 'src/_control.i', |
54f9ee45 RD |
99 | ], |
100 | True) | |
1b62f00d | 101 | |
1e4a197e | 102 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
99abd512 | 103 | CLEANUP.append(opj(PKGDIR, '__init__.py')) |
1b62f00d RD |
104 | |
105 | ||
d14a1e28 RD |
106 | # update the license files |
107 | mkpath('licence') | |
108 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
109 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
99abd512 RD |
110 | CLEANUP.append(opj('licence',file)) |
111 | CLEANUP.append('licence') | |
c368d904 | 112 | |
c368d904 | 113 | |
1e4a197e RD |
114 | if os.name == 'nt': |
115 | build_locale_dir(opj(PKGDIR, 'locale')) | |
116 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
117 | |
118 | ||
1e4a197e RD |
119 | if os.name == 'nt': |
120 | rc_file = ['src/wxc.rc'] | |
121 | else: | |
122 | rc_file = [] | |
123 | ||
124 | ||
54f9ee45 RD |
125 | ext = Extension('_core_', ['src/helpers.cpp', |
126 | 'src/libpy.c', | |
127 | ] + rc_file + swig_sources, | |
1e4a197e RD |
128 | |
129 | include_dirs = includes, | |
130 | define_macros = defines, | |
131 | ||
132 | library_dirs = libdirs, | |
133 | libraries = libs, | |
134 | ||
135 | extra_compile_args = cflags, | |
136 | extra_link_args = lflags, | |
d14a1e28 RD |
137 | |
138 | depends = depends | |
1e4a197e RD |
139 | ) |
140 | wxpExtensions.append(ext) | |
141 | ||
142 | ||
d14a1e28 RD |
143 | |
144 | ||
145 | ||
146 | # Extension for the GDI module | |
147 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
148 | USE_SWIG, swig_force, swig_args, swig_deps + | |
54f9ee45 | 149 | ['src/__gdi_rename.i', |
99abd512 RD |
150 | 'src/_bitmap.i', |
151 | 'src/_colour.i', | |
152 | 'src/_dc.i', | |
153 | 'src/_gdiobj.i', | |
154 | 'src/_imaglist.i', | |
155 | 'src/_region.i', | |
156 | 'src/_stockobjs.i', | |
d14a1e28 | 157 | 'src/_effects.i', |
99abd512 RD |
158 | 'src/_intl.i', |
159 | 'src/_intl_ex.py', | |
160 | 'src/_brush.i', | |
161 | 'src/_cursor.i', | |
162 | 'src/_font.i', | |
163 | 'src/_icon.i', | |
164 | 'src/_pen.i', | |
165 | 'src/_palette.i', | |
54f9ee45 RD |
166 | ], |
167 | True) | |
168 | ext = Extension('_gdi_', ['src/drawlist.cpp'] + swig_sources, | |
1e4a197e RD |
169 | include_dirs = includes, |
170 | define_macros = defines, | |
171 | library_dirs = libdirs, | |
172 | libraries = libs, | |
173 | extra_compile_args = cflags, | |
174 | extra_link_args = lflags, | |
d14a1e28 | 175 | depends = depends |
1e4a197e RD |
176 | ) |
177 | wxpExtensions.append(ext) | |
178 | ||
179 | ||
d14a1e28 RD |
180 | |
181 | ||
182 | ||
183 | ||
184 | # Extension for the windows module | |
185 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
186 | USE_SWIG, swig_force, swig_args, swig_deps + | |
54f9ee45 RD |
187 | ['src/__windows_rename.i', |
188 | 'src/__windows_reverse.txt', | |
d14a1e28 | 189 | 'src/_panel.i', |
99abd512 RD |
190 | 'src/_toplvl.i', |
191 | 'src/_statusbar.i', | |
192 | 'src/_splitter.i', | |
193 | 'src/_sashwin.i', | |
194 | 'src/_popupwin.i', | |
195 | 'src/_tipwin.i', | |
196 | 'src/_vscroll.i', | |
197 | 'src/_taskbar.i', | |
198 | 'src/_cmndlgs.i', | |
199 | 'src/_mdi.i', | |
200 | 'src/_pywindows.i', | |
201 | 'src/_printfw.i', | |
54f9ee45 RD |
202 | ], |
203 | True) | |
204 | ext = Extension('_windows_', swig_sources, | |
1e4a197e RD |
205 | include_dirs = includes, |
206 | define_macros = defines, | |
207 | library_dirs = libdirs, | |
208 | libraries = libs, | |
209 | extra_compile_args = cflags, | |
210 | extra_link_args = lflags, | |
d14a1e28 | 211 | depends = depends |
1e4a197e RD |
212 | ) |
213 | wxpExtensions.append(ext) | |
214 | ||
215 | ||
d14a1e28 RD |
216 | |
217 | ||
218 | # Extension for the controls module | |
219 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
220 | USE_SWIG, swig_force, swig_args, swig_deps + | |
54f9ee45 RD |
221 | [ 'src/__controls_rename.i', |
222 | 'src/__controls_reverse.txt', | |
cf636c45 | 223 | 'src/_toolbar.i', |
99abd512 RD |
224 | 'src/_button.i', |
225 | 'src/_checkbox.i', | |
226 | 'src/_choice.i', | |
227 | 'src/_combobox.i', | |
228 | 'src/_gauge.i', | |
229 | 'src/_statctrls.i', | |
230 | 'src/_listbox.i', | |
231 | 'src/_textctrl.i', | |
232 | 'src/_scrolbar.i', | |
233 | 'src/_spin.i', | |
234 | 'src/_radio.i', | |
235 | 'src/_slider.i', | |
236 | 'src/_tglbtn.i', | |
237 | 'src/_notebook.i', | |
238 | 'src/_listctrl.i', | |
239 | 'src/_treectrl.i', | |
240 | 'src/_dirctrl.i', | |
241 | 'src/_pycontrol.i', | |
242 | 'src/_cshelp.i', | |
243 | 'src/_dragimg.i', | |
54f9ee45 RD |
244 | ], |
245 | True) | |
246 | ext = Extension('_controls_', swig_sources, | |
d14a1e28 RD |
247 | include_dirs = includes, |
248 | define_macros = defines, | |
249 | library_dirs = libdirs, | |
250 | libraries = libs, | |
251 | extra_compile_args = cflags, | |
252 | extra_link_args = lflags, | |
253 | depends = depends | |
254 | ) | |
255 | wxpExtensions.append(ext) | |
256 | ||
257 | ||
258 | ||
259 | ||
260 | # Extension for the misc module | |
261 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
262 | USE_SWIG, swig_force, swig_args, swig_deps + | |
54f9ee45 RD |
263 | [ 'src/__misc_rename.i', |
264 | 'src/__misc_reverse.txt', | |
265 | 'src/_settings.i', | |
99abd512 RD |
266 | 'src/_functions.i', |
267 | 'src/_misc.i', | |
268 | 'src/_tipdlg.i', | |
269 | 'src/_timer.i', | |
270 | 'src/_log.i', | |
271 | 'src/_process.i', | |
272 | 'src/_joystick.i', | |
273 | 'src/_sound.i', | |
274 | 'src/_mimetype.i', | |
275 | 'src/_artprov.i', | |
276 | 'src/_config.i', | |
277 | 'src/_datetime.i', | |
278 | 'src/_dataobj.i', | |
279 | 'src/_dnd.i', | |
280 | 'src/_display.i', | |
d14a1e28 | 281 | 'src/_clipbrd.i', |
54f9ee45 RD |
282 | ], |
283 | True) | |
284 | ext = Extension('_misc_', swig_sources, | |
d14a1e28 RD |
285 | include_dirs = includes, |
286 | define_macros = defines, | |
287 | library_dirs = libdirs, | |
288 | libraries = libs, | |
289 | extra_compile_args = cflags, | |
290 | extra_link_args = lflags, | |
291 | depends = depends | |
292 | ) | |
293 | wxpExtensions.append(ext) | |
294 | ||
295 | ||
296 | ||
297 | ## | |
298 | ## Core modules that are not in the "core" namespace start here | |
299 | ## | |
300 | ||
1e4a197e RD |
301 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, |
302 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 RD |
303 | ext = Extension('_calendar', swig_sources, |
304 | include_dirs = includes, | |
305 | define_macros = defines, | |
306 | library_dirs = libdirs, | |
307 | libraries = libs, | |
308 | extra_compile_args = cflags, | |
309 | extra_link_args = lflags, | |
310 | depends = depends | |
311 | ) | |
312 | wxpExtensions.append(ext) | |
313 | ||
314 | ||
315 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
316 | USE_SWIG, swig_force, swig_args, swig_deps) | |
317 | ext = Extension('_grid', swig_sources, | |
1e4a197e RD |
318 | include_dirs = includes, |
319 | define_macros = defines, | |
320 | library_dirs = libdirs, | |
321 | libraries = libs, | |
322 | extra_compile_args = cflags, | |
323 | extra_link_args = lflags, | |
d14a1e28 | 324 | depends = depends |
1e4a197e RD |
325 | ) |
326 | wxpExtensions.append(ext) | |
327 | ||
328 | ||
d14a1e28 RD |
329 | |
330 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
1e4a197e | 331 | USE_SWIG, swig_force, swig_args, swig_deps) |
d14a1e28 | 332 | ext = Extension('_html', swig_sources, |
1e4a197e RD |
333 | include_dirs = includes, |
334 | define_macros = defines, | |
335 | library_dirs = libdirs, | |
336 | libraries = libs, | |
337 | extra_compile_args = cflags, | |
338 | extra_link_args = lflags, | |
d14a1e28 | 339 | depends = depends |
1e4a197e RD |
340 | ) |
341 | wxpExtensions.append(ext) | |
342 | ||
343 | ||
d14a1e28 | 344 | |
1e4a197e RD |
345 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, |
346 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 | 347 | ext = Extension('_wizard', swig_sources, |
1e4a197e RD |
348 | include_dirs = includes, |
349 | define_macros = defines, | |
350 | library_dirs = libdirs, | |
351 | libraries = libs, | |
352 | extra_compile_args = cflags, | |
353 | extra_link_args = lflags, | |
d14a1e28 | 354 | depends = depends |
1e4a197e RD |
355 | ) |
356 | wxpExtensions.append(ext) | |
af83019e RD |
357 | |
358 | ||
38b97c15 RD |
359 | |
360 | swig_sources = run_swig(['xrc.i'], 'src', GENDIR, PKGDIR, | |
361 | USE_SWIG, swig_force, swig_args, swig_deps + | |
362 | [ 'src/_xrc_rename.i', | |
363 | 'src/_xrc_ex.py', | |
364 | 'src/_xmlres.i', | |
365 | 'src/_xmlsub.i', | |
366 | 'src/_xml.i', | |
367 | 'src/_xmlhandler.i', | |
368 | ]) | |
369 | ext = Extension('_xrc', | |
370 | swig_sources, | |
371 | ||
372 | include_dirs = includes + CONTRIBS_INC, | |
373 | define_macros = defines, | |
374 | ||
375 | library_dirs = libdirs, | |
376 | libraries = libs, | |
377 | ||
378 | extra_compile_args = cflags, | |
379 | extra_link_args = lflags, | |
380 | ) | |
381 | wxpExtensions.append(ext) | |
382 | ||
383 | ||
c368d904 RD |
384 | #---------------------------------------------------------------------- |
385 | # Define the GLCanvas extension module | |
386 | #---------------------------------------------------------------------- | |
387 | ||
1e4a197e | 388 | if BUILD_GLCANVAS: |
cfe766c3 | 389 | msg('Preparing GLCANVAS...') |
c368d904 | 390 | location = 'contrib/glcanvas' |
c368d904 | 391 | |
d14a1e28 | 392 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, |
10ef30eb | 393 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
394 | |
395 | gl_libs = [] | |
396 | if os.name == 'posix': | |
cb9a93a2 | 397 | gl_config = os.popen(WX_CONFIG + ' --libs gl', 'r').read()[:-1] |
1e4a197e | 398 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 399 | gl_libs = libs |
19cf4f80 | 400 | else: |
3e46a8e6 | 401 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') |
f32afe1c | 402 | gl_lflags = lflags |
c368d904 | 403 | |
d14a1e28 | 404 | ext = Extension('_glcanvas', |
3e46a8e6 | 405 | swig_sources, |
1e7ecb7b | 406 | |
4c417214 | 407 | include_dirs = includes + CONTRIBS_INC, |
1e7ecb7b RD |
408 | define_macros = defines, |
409 | ||
410 | library_dirs = libdirs, | |
f32afe1c | 411 | libraries = gl_libs, |
1e7ecb7b RD |
412 | |
413 | extra_compile_args = cflags, | |
f32afe1c | 414 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
415 | ) |
416 | ||
417 | wxpExtensions.append(ext) | |
c368d904 RD |
418 | |
419 | ||
420 | #---------------------------------------------------------------------- | |
421 | # Define the OGL extension module | |
422 | #---------------------------------------------------------------------- | |
423 | ||
1e4a197e | 424 | if BUILD_OGL: |
cfe766c3 | 425 | msg('Preparing OGL...') |
c368d904 | 426 | location = 'contrib/ogl' |
c368d904 | 427 | |
a32360e0 | 428 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, |
d14a1e28 RD |
429 | USE_SWIG, swig_force, swig_args, swig_deps + |
430 | [ '%s/_oglbasic.i' % location, | |
431 | '%s/_oglshapes.i' % location, | |
432 | '%s/_oglshapes2.i' % location, | |
433 | '%s/_oglcanvas.i' % location, | |
434 | '%s/_ogldefs.i' % location, | |
435 | ]) | |
c368d904 | 436 | |
d14a1e28 | 437 | ext = Extension('_ogl', |
3ef86e32 | 438 | swig_sources, |
1e7ecb7b | 439 | |
4c417214 | 440 | include_dirs = includes + [ location ] + CONTRIBS_INC, |
dd116e73 | 441 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], |
1e7ecb7b RD |
442 | |
443 | library_dirs = libdirs, | |
3ef86e32 | 444 | libraries = libs + makeLibName('ogl'), |
1e7ecb7b RD |
445 | |
446 | extra_compile_args = cflags, | |
447 | extra_link_args = lflags, | |
448 | ) | |
449 | ||
450 | wxpExtensions.append(ext) | |
451 | ||
452 | ||
c368d904 RD |
453 | |
454 | #---------------------------------------------------------------------- | |
455 | # Define the STC extension module | |
456 | #---------------------------------------------------------------------- | |
457 | ||
1e4a197e | 458 | if BUILD_STC: |
cfe766c3 | 459 | msg('Preparing STC...') |
c368d904 | 460 | location = 'contrib/stc' |
020fb2ee RD |
461 | #if os.name == 'nt': |
462 | STC_H = opj(WXDIR, 'contrib', 'include/wx/stc') | |
463 | #else: | |
464 | # STC_H = opj(WXPREFIX, 'include/wx-%d.%d/wx/stc' % (VER_MAJOR, VER_MINOR)) | |
55c020cf | 465 | |
de7b7fe6 | 466 | ## NOTE: need to add something like this to the stc.bkl... |
55c020cf | 467 | |
3ef86e32 RD |
468 | ## # Check if gen_iface needs to be run for the wxSTC sources |
469 | ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
470 | ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
471 | ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
55c020cf | 472 | |
3ef86e32 RD |
473 | ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') |
474 | ## cwd = os.getcwd() | |
475 | ## os.chdir(opj(CTRB_SRC, 'stc')) | |
476 | ## sys.path.insert(0, os.curdir) | |
477 | ## import gen_iface | |
478 | ## gen_iface.main([]) | |
479 | ## os.chdir(cwd) | |
c368d904 RD |
480 | |
481 | ||
befa6977 | 482 | swig_sources = run_swig(['stc.i'], location, GENDIR, PKGDIR, |
c368d904 RD |
483 | USE_SWIG, swig_force, |
484 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 485 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 486 | |
d14a1e28 | 487 | ext = Extension('_stc', |
3ef86e32 RD |
488 | swig_sources, |
489 | ||
4c417214 | 490 | include_dirs = includes + CONTRIBS_INC, |
3ef86e32 | 491 | define_macros = defines, |
1e7ecb7b RD |
492 | |
493 | library_dirs = libdirs, | |
3ef86e32 | 494 | libraries = libs + makeLibName('stc'), |
c368d904 | 495 | |
1e7ecb7b RD |
496 | extra_compile_args = cflags, |
497 | extra_link_args = lflags, | |
498 | ) | |
499 | ||
500 | wxpExtensions.append(ext) | |
c368d904 RD |
501 | |
502 | ||
503 | ||
926bb76c RD |
504 | #---------------------------------------------------------------------- |
505 | # Define the IEWIN extension module (experimental) | |
506 | #---------------------------------------------------------------------- | |
507 | ||
1e4a197e | 508 | if BUILD_IEWIN: |
cfe766c3 | 509 | msg('Preparing IEWIN...') |
926bb76c RD |
510 | location = 'contrib/iewin' |
511 | ||
512 | swig_files = ['iewin.i', ] | |
513 | ||
514 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 515 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
516 | |
517 | ||
de7b7fe6 | 518 | ext = Extension('_iewin', ['%s/IEHtmlWin.cpp' % location, |
c731eb47 | 519 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
520 | ] + swig_sources, |
521 | ||
4c417214 | 522 | include_dirs = includes + CONTRIBS_INC, |
926bb76c RD |
523 | define_macros = defines, |
524 | ||
525 | library_dirs = libdirs, | |
526 | libraries = libs, | |
527 | ||
528 | extra_compile_args = cflags, | |
b7c75283 RD |
529 | extra_link_args = lflags, |
530 | ) | |
531 | ||
532 | wxpExtensions.append(ext) | |
533 | ||
534 | ||
535 | #---------------------------------------------------------------------- | |
536 | # Define the ACTIVEX extension module (experimental) | |
537 | #---------------------------------------------------------------------- | |
538 | ||
539 | if BUILD_ACTIVEX: | |
540 | msg('Preparing ACTIVEX...') | |
541 | location = 'contrib/activex' | |
542 | axloc = opj(location, "wxie") | |
543 | ||
544 | swig_files = ['activex.i', ] | |
545 | ||
546 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
547 | USE_SWIG, swig_force, swig_args, swig_deps + | |
548 | [ '%s/_activex_ex.py' % location]) | |
549 | ||
550 | ||
551 | ext = Extension('_activex', ['%s/IEHtmlWin.cpp' % axloc, | |
552 | '%s/wxactivex.cpp' % axloc, | |
553 | ] + swig_sources, | |
554 | ||
555 | include_dirs = includes + [ axloc ], | |
556 | define_macros = defines, | |
557 | ||
558 | library_dirs = libdirs, | |
559 | libraries = libs, | |
560 | ||
561 | extra_compile_args = cflags, | |
926bb76c RD |
562 | extra_link_args = lflags, |
563 | ) | |
564 | ||
565 | wxpExtensions.append(ext) | |
566 | ||
567 | ||
ebf4302c RD |
568 | #---------------------------------------------------------------------- |
569 | # Define the GIZMOS extension module | |
570 | #---------------------------------------------------------------------- | |
571 | ||
1e4a197e | 572 | if BUILD_GIZMOS: |
ebf4302c RD |
573 | msg('Preparing GIZMOS...') |
574 | location = 'contrib/gizmos' | |
ebf4302c | 575 | |
a32360e0 | 576 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, |
10ef30eb | 577 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c | 578 | |
d14a1e28 | 579 | ext = Extension('_gizmos', |
28eab81f | 580 | [ '%s/treelistctrl.cpp' % opj(location, 'wxCode/src') ] + swig_sources, |
ebf4302c | 581 | |
28eab81f | 582 | include_dirs = includes + [ location, opj(location, 'wxCode/include') ] + CONTRIBS_INC, |
ebf4302c RD |
583 | define_macros = defines, |
584 | ||
585 | library_dirs = libdirs, | |
3ef86e32 | 586 | libraries = libs + makeLibName('gizmos'), |
ebf4302c RD |
587 | |
588 | extra_compile_args = cflags, | |
589 | extra_link_args = lflags, | |
590 | ) | |
591 | ||
592 | wxpExtensions.append(ext) | |
593 | ||
594 | ||
595 | ||
4a61305d RD |
596 | #---------------------------------------------------------------------- |
597 | # Define the DLLWIDGET extension module | |
598 | #---------------------------------------------------------------------- | |
599 | ||
1e4a197e | 600 | if BUILD_DLLWIDGET: |
4a61305d RD |
601 | msg('Preparing DLLWIDGET...') |
602 | location = 'contrib/dllwidget' | |
603 | swig_files = ['dllwidget_.i'] | |
604 | ||
605 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 606 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
607 | |
608 | # copy a contrib project specific py module to the main package dir | |
609 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
99abd512 | 610 | CLEANUP.append(opj(PKGDIR, 'dllwidget.py')) |
4a61305d RD |
611 | |
612 | ext = Extension('dllwidget_c', [ | |
613 | '%s/dllwidget.cpp' % location, | |
614 | ] + swig_sources, | |
615 | ||
4c417214 | 616 | include_dirs = includes + CONTRIBS_INC, |
4a61305d RD |
617 | define_macros = defines, |
618 | ||
619 | library_dirs = libdirs, | |
620 | libraries = libs, | |
621 | ||
622 | extra_compile_args = cflags, | |
623 | extra_link_args = lflags, | |
624 | ) | |
625 | ||
626 | wxpExtensions.append(ext) | |
627 | ||
628 | ||
1e4a197e | 629 | |
38b97c15 RD |
630 | #---------------------------------------------------------------------- |
631 | # patch distutils if it can't cope with the "classifiers" or | |
632 | # "download_url" keywords | |
633 | #---------------------------------------------------------------------- | |
634 | ||
635 | if sys.version < '2.2.3': | |
636 | from distutils.dist import DistributionMetadata | |
637 | DistributionMetadata.classifiers = None | |
638 | DistributionMetadata.download_url = None | |
1e4a197e | 639 | |
38b97c15 | 640 | |
1e4a197e | 641 | #---------------------------------------------------------------------- |
1128a89b | 642 | # Tools, scripts data files, etc. |
1e4a197e | 643 | #---------------------------------------------------------------------- |
8916d007 | 644 | |
2eb31f8b RD |
645 | if NO_SCRIPTS: |
646 | SCRIPTS = None | |
647 | else: | |
1e4a197e RD |
648 | SCRIPTS = [opj('scripts/helpviewer'), |
649 | opj('scripts/img2png'), | |
2eb31f8b | 650 | opj('scripts/img2py'), |
d48c1c64 RD |
651 | opj('scripts/img2xpm'), |
652 | opj('scripts/pyalacarte'), | |
653 | opj('scripts/pyalamode'), | |
2eb31f8b | 654 | opj('scripts/pycrust'), |
d48c1c64 | 655 | opj('scripts/pyshell'), |
1fded56b RD |
656 | opj('scripts/pywrap'), |
657 | opj('scripts/pywrap'), | |
b6536d60 | 658 | opj('scripts/pywxrc'), |
d48c1c64 | 659 | opj('scripts/xrced'), |
2eb31f8b | 660 | ] |
d48c1c64 | 661 | |
4a61305d | 662 | |
926bb76c | 663 | |
c2079460 RD |
664 | DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc') |
665 | DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html') | |
1fded56b | 666 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') |
1e4a197e RD |
667 | |
668 | ||
1128a89b RD |
669 | if NO_HEADERS: |
670 | HEADERS = None | |
671 | else: | |
672 | h_files = glob.glob(opj("include/wx/wxPython/*.h")) | |
673 | i_files = glob.glob(opj("src/*.i")) + \ | |
674 | glob.glob(opj("src/_*.py")) + \ | |
675 | glob.glob(opj("src/*.swg")) | |
676 | ||
e9019d1c RD |
677 | HEADERS = zip(h_files, ["/wxPython"]*len(h_files)) + \ |
678 | zip(i_files, ["/wxPython/i_files"]*len(i_files)) | |
679 | ||
1128a89b | 680 | |
d48c1c64 RD |
681 | |
682 | if INSTALL_MULTIVERSION: | |
b6536d60 | 683 | EXTRA_PATH = getExtraPath(addOpts=EP_ADD_OPTS) |
d48c1c64 RD |
684 | open("src/wx.pth", "w").write(EXTRA_PATH) |
685 | CLEANUP.append("src/wx.pth") | |
686 | else: | |
687 | EXTRA_PATH = None | |
688 | ||
689 | ||
690 | ||
c368d904 RD |
691 | #---------------------------------------------------------------------- |
692 | # Do the Setup/Build/Install/Whatever | |
693 | #---------------------------------------------------------------------- | |
694 | ||
1b62f00d | 695 | if __name__ == "__main__": |
1e4a197e | 696 | if not PREP_ONLY: |
d48c1c64 | 697 | |
d14a1e28 | 698 | setup(name = 'wxPython', |
1b62f00d RD |
699 | version = VERSION, |
700 | description = DESCRIPTION, | |
701 | long_description = LONG_DESCRIPTION, | |
702 | author = AUTHOR, | |
703 | author_email = AUTHOR_EMAIL, | |
704 | url = URL, | |
851d4ac7 | 705 | download_url = DOWNLOAD_URL, |
e2e02194 | 706 | license = LICENSE, |
851d4ac7 RD |
707 | platforms = PLATFORMS, |
708 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
709 | keywords = KEYWORDS, | |
d14a1e28 | 710 | |
1fded56b RD |
711 | packages = ['wxPython', |
712 | 'wxPython.lib', | |
713 | 'wxPython.lib.colourchooser', | |
714 | 'wxPython.lib.editor', | |
715 | 'wxPython.lib.mixins', | |
1fded56b | 716 | 'wxPython.tools', |
1fded56b RD |
717 | |
718 | 'wx', | |
1128a89b | 719 | 'wx.build', |
1fded56b RD |
720 | 'wx.lib', |
721 | 'wx.lib.colourchooser', | |
722 | 'wx.lib.editor', | |
42463de2 | 723 | 'wx.lib.floatcanvas', |
9176f38f | 724 | 'wx.lib.masked', |
1fded56b | 725 | 'wx.lib.mixins', |
f847103a | 726 | 'wx.lib.ogl', |
1fded56b RD |
727 | 'wx.py', |
728 | 'wx.tools', | |
729 | 'wx.tools.XRCed', | |
1b62f00d RD |
730 | ], |
731 | ||
d48c1c64 RD |
732 | extra_path = EXTRA_PATH, |
733 | ||
1b62f00d RD |
734 | ext_package = PKGDIR, |
735 | ext_modules = wxpExtensions, | |
8916d007 | 736 | |
1128a89b RD |
737 | options = { 'build' : { 'build_base' : BUILD_BASE }, |
738 | }, | |
a541c325 | 739 | |
1128a89b | 740 | scripts = SCRIPTS, |
1e4a197e | 741 | data_files = DATA_FILES, |
1128a89b | 742 | headers = HEADERS, |
8916d007 | 743 | |
d48c1c64 RD |
744 | # Override some of the default distutils command classes with my own |
745 | cmdclass = { 'install' : wx_install, | |
746 | 'install_data': wx_smart_install_data, | |
1128a89b RD |
747 | 'install_headers': wx_install_headers, |
748 | 'clean': wx_extra_clean, | |
749 | }, | |
1b62f00d | 750 | ) |
c368d904 | 751 | |
c368d904 | 752 | |
d48c1c64 RD |
753 | if INSTALL_MULTIVERSION: |
754 | setup(name = 'wxPython-common', | |
755 | version = VERSION, | |
756 | description = DESCRIPTION, | |
757 | long_description = LONG_DESCRIPTION, | |
758 | author = AUTHOR, | |
759 | author_email = AUTHOR_EMAIL, | |
760 | url = URL, | |
761 | download_url = DOWNLOAD_URL, | |
762 | license = LICENSE, | |
763 | platforms = PLATFORMS, | |
764 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
765 | keywords = KEYWORDS, | |
766 | ||
767 | package_dir = { '': 'wxversion' }, | |
768 | py_modules = ['wxversion'], | |
769 | ||
770 | data_files = [('', ['src/wx.pth'])], | |
771 | ||
772 | options = { 'build' : { 'build_base' : BUILD_BASE }, | |
773 | }, | |
774 | ||
775 | cmdclass = { 'install_data': wx_smart_install_data, | |
776 | }, | |
777 | ) | |
778 | ||
c368d904 RD |
779 | #---------------------------------------------------------------------- |
780 | #---------------------------------------------------------------------- |