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