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