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