]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env python | |
2 | #---------------------------------------------------------------------- | |
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 | |
12 | #---------------------------------------------------------------------- | |
13 | ||
14 | import sys | |
15 | ||
16 | ||
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. | |
25 | ||
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 | ||
32 | sys.setup_is_main = __name__ == "__main__" # an icky hack! | |
33 | from config import * | |
34 | ||
35 | ||
36 | #---------------------------------------------------------------------- | |
37 | # Update the packaged config file. | |
38 | #---------------------------------------------------------------------- | |
39 | ||
40 | copy_file('config.py', 'wx/build', update=1, verbose=1) | |
41 | CLEANUP.append('wx/build/config.py') | |
42 | ||
43 | #---------------------------------------------------------------------- | |
44 | # Update the version file | |
45 | #---------------------------------------------------------------------- | |
46 | ||
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 | ||
50 | open('wx/__version__.py', 'w').write("""\ | |
51 | # This file was generated by setup.py... | |
52 | ||
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 | |
58 | ||
59 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, | |
60 | SUBREL_VERSION, '%(VER_FLAGS)s') | |
61 | ||
62 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility | |
63 | """ % globals()) | |
64 | ||
65 | CLEANUP.append('wx/__version__.py') | |
66 | ||
67 | ||
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 | ||
82 | #---------------------------------------------------------------------- | |
83 | # Define the CORE extension module | |
84 | #---------------------------------------------------------------------- | |
85 | ||
86 | msg('Preparing CORE...') | |
87 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, | |
88 | USE_SWIG, swig_force, swig_args, swig_deps + | |
89 | [ 'src/_accel.i', | |
90 | 'src/_app.i', | |
91 | 'src/_app_ex.py', | |
92 | 'src/_constraints.i', | |
93 | 'src/_core_api.i', | |
94 | 'src/_core_ex.py', | |
95 | 'src/__core_rename.i', | |
96 | 'src/__core_reverse.txt', | |
97 | 'src/_defs.i', | |
98 | 'src/_event.i', | |
99 | 'src/_event_ex.py', | |
100 | 'src/_evtloop.i', | |
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', | |
112 | 'src/_control.i', | |
113 | ], | |
114 | True) | |
115 | ||
116 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) | |
117 | CLEANUP.append(opj(PKGDIR, '__init__.py')) | |
118 | ||
119 | ||
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) | |
124 | CLEANUP.append(opj('licence',file)) | |
125 | CLEANUP.append('licence') | |
126 | ||
127 | ||
128 | if os.name == 'nt': | |
129 | build_locale_dir(opj(PKGDIR, 'locale')) | |
130 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
131 | ||
132 | ||
133 | if os.name == 'nt': | |
134 | rc_file = ['src/wxc.rc'] | |
135 | else: | |
136 | rc_file = [] | |
137 | ||
138 | ||
139 | ext = Extension('_core_', ['src/helpers.cpp', | |
140 | ] + rc_file + swig_sources, | |
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, | |
150 | ||
151 | **depends | |
152 | ) | |
153 | wxpExtensions.append(ext) | |
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 | # Extension for the GDI module | |
160 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
161 | USE_SWIG, swig_force, swig_args, swig_deps + | |
162 | ['src/__gdi_rename.i', | |
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', | |
170 | 'src/_effects.i', | |
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', | |
179 | ], | |
180 | True) | |
181 | ext = Extension('_gdi_', ['src/drawlist.cpp'] + swig_sources, | |
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, | |
188 | **depends | |
189 | ) | |
190 | wxpExtensions.append(ext) | |
191 | ||
192 | ||
193 | ||
194 | ||
195 | ||
196 | ||
197 | # Extension for the windows module | |
198 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
199 | USE_SWIG, swig_force, swig_args, swig_deps + | |
200 | ['src/__windows_rename.i', | |
201 | 'src/__windows_reverse.txt', | |
202 | 'src/_panel.i', | |
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', | |
215 | ], | |
216 | True) | |
217 | ext = Extension('_windows_', swig_sources, | |
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, | |
224 | **depends | |
225 | ) | |
226 | wxpExtensions.append(ext) | |
227 | ||
228 | ||
229 | ||
230 | ||
231 | # Extension for the controls module | |
232 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
233 | USE_SWIG, swig_force, swig_args, swig_deps + | |
234 | [ 'src/__controls_rename.i', | |
235 | 'src/__controls_reverse.txt', | |
236 | 'src/_toolbar.i', | |
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', | |
257 | ], | |
258 | True) | |
259 | ext = Extension('_controls_', swig_sources, | |
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, | |
266 | **depends | |
267 | ) | |
268 | wxpExtensions.append(ext) | |
269 | ||
270 | ||
271 | ||
272 | ||
273 | # Extension for the misc module | |
274 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
275 | USE_SWIG, swig_force, swig_args, swig_deps + | |
276 | [ 'src/__misc_rename.i', | |
277 | 'src/__misc_reverse.txt', | |
278 | 'src/_settings.i', | |
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', | |
294 | 'src/_clipbrd.i', | |
295 | 'src/_stdpaths.i', | |
296 | ], | |
297 | True) | |
298 | ext = Extension('_misc_', swig_sources, | |
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, | |
305 | **depends | |
306 | ) | |
307 | wxpExtensions.append(ext) | |
308 | ||
309 | ||
310 | ||
311 | ## | |
312 | ## Core modules that are not in the "core" namespace start here | |
313 | ## | |
314 | ||
315 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
316 | USE_SWIG, swig_force, swig_args, swig_deps) | |
317 | ext = 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, | |
324 | **depends | |
325 | ) | |
326 | wxpExtensions.append(ext) | |
327 | ||
328 | ||
329 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
330 | USE_SWIG, swig_force, swig_args, swig_deps) | |
331 | ext = Extension('_grid', swig_sources, | |
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, | |
338 | **depends | |
339 | ) | |
340 | wxpExtensions.append(ext) | |
341 | ||
342 | ||
343 | ||
344 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
345 | USE_SWIG, swig_force, swig_args, swig_deps) | |
346 | ext = Extension('_html', swig_sources, | |
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, | |
353 | **depends | |
354 | ) | |
355 | wxpExtensions.append(ext) | |
356 | ||
357 | ||
358 | mediaLibs = libs[:] | |
359 | if not MONOLITHIC and os.name == 'nt': | |
360 | mediaLibs.append(makeLibName('media')[0]) | |
361 | swig_sources = run_swig(['media.i'], 'src', GENDIR, PKGDIR, | |
362 | USE_SWIG, swig_force, swig_args, swig_deps) | |
363 | ext = Extension('_media', swig_sources, | |
364 | include_dirs = includes, | |
365 | define_macros = defines, | |
366 | library_dirs = libdirs, | |
367 | libraries = mediaLibs, | |
368 | extra_compile_args = cflags, | |
369 | extra_link_args = lflags, | |
370 | **depends | |
371 | ) | |
372 | wxpExtensions.append(ext) | |
373 | ||
374 | ||
375 | swig_sources = run_swig(['webkit.i'], 'src', GENDIR, PKGDIR, | |
376 | USE_SWIG, swig_force, swig_args, swig_deps) | |
377 | ext = 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 | ) | |
386 | wxpExtensions.append(ext) | |
387 | ||
388 | ||
389 | ||
390 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, | |
391 | USE_SWIG, swig_force, swig_args, swig_deps) | |
392 | ext = Extension('_wizard', swig_sources, | |
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, | |
399 | **depends | |
400 | ) | |
401 | wxpExtensions.append(ext) | |
402 | ||
403 | ||
404 | ||
405 | swig_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 | ]) | |
414 | ext = 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 | ) | |
426 | wxpExtensions.append(ext) | |
427 | ||
428 | ||
429 | #---------------------------------------------------------------------- | |
430 | # Define the GLCanvas extension module | |
431 | #---------------------------------------------------------------------- | |
432 | ||
433 | if BUILD_GLCANVAS: | |
434 | msg('Preparing GLCANVAS...') | |
435 | location = 'contrib/glcanvas' | |
436 | ||
437 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, | |
438 | USE_SWIG, swig_force, swig_args, swig_deps) | |
439 | ||
440 | gl_libs = [] | |
441 | if os.name == 'posix': | |
442 | gl_config = os.popen(WX_CONFIG + ' --libs gl', 'r').read()[:-1] | |
443 | gl_lflags = gl_config.split() + lflags | |
444 | gl_libs = libs | |
445 | else: | |
446 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') | |
447 | gl_lflags = lflags | |
448 | ||
449 | ext = Extension('_glcanvas', | |
450 | swig_sources, | |
451 | ||
452 | include_dirs = includes + CONTRIBS_INC, | |
453 | define_macros = defines, | |
454 | ||
455 | library_dirs = libdirs, | |
456 | libraries = gl_libs, | |
457 | ||
458 | extra_compile_args = cflags, | |
459 | extra_link_args = gl_lflags, | |
460 | ) | |
461 | ||
462 | wxpExtensions.append(ext) | |
463 | ||
464 | ||
465 | #---------------------------------------------------------------------- | |
466 | # Define the OGL extension module | |
467 | #---------------------------------------------------------------------- | |
468 | ||
469 | if BUILD_OGL: | |
470 | msg('Preparing OGL...') | |
471 | location = 'contrib/ogl' | |
472 | ||
473 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, | |
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 | ]) | |
481 | ||
482 | ext = Extension('_ogl', | |
483 | swig_sources, | |
484 | ||
485 | include_dirs = includes + [ location ] + CONTRIBS_INC, | |
486 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], | |
487 | ||
488 | library_dirs = libdirs, | |
489 | libraries = libs + makeLibName('ogl'), | |
490 | ||
491 | extra_compile_args = cflags, | |
492 | extra_link_args = lflags, | |
493 | ) | |
494 | ||
495 | wxpExtensions.append(ext) | |
496 | ||
497 | ||
498 | ||
499 | #---------------------------------------------------------------------- | |
500 | # Define the STC extension module | |
501 | #---------------------------------------------------------------------- | |
502 | ||
503 | if BUILD_STC: | |
504 | msg('Preparing STC...') | |
505 | location = 'contrib/stc' | |
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)) | |
510 | ||
511 | ## NOTE: need to add something like this to the stc.bkl... | |
512 | ||
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'))): | |
517 | ||
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) | |
525 | ||
526 | ||
527 | swig_sources = run_swig(['stc.i'], location, GENDIR, PKGDIR, | |
528 | USE_SWIG, swig_force, | |
529 | swig_args + ['-I'+STC_H, '-I'+location], | |
530 | [opj(STC_H, 'stc.h')] + swig_deps) | |
531 | ||
532 | ext = Extension('_stc', | |
533 | swig_sources, | |
534 | ||
535 | include_dirs = includes + CONTRIBS_INC, | |
536 | define_macros = defines, | |
537 | ||
538 | library_dirs = libdirs, | |
539 | libraries = libs + makeLibName('stc'), | |
540 | ||
541 | extra_compile_args = cflags, | |
542 | extra_link_args = lflags, | |
543 | ) | |
544 | ||
545 | wxpExtensions.append(ext) | |
546 | ||
547 | ||
548 | ||
549 | #---------------------------------------------------------------------- | |
550 | # Define the IEWIN extension module (experimental) | |
551 | #---------------------------------------------------------------------- | |
552 | ||
553 | if BUILD_IEWIN: | |
554 | msg('Preparing IEWIN...') | |
555 | location = 'contrib/iewin' | |
556 | ||
557 | swig_files = ['iewin.i', ] | |
558 | ||
559 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
560 | USE_SWIG, swig_force, swig_args, swig_deps) | |
561 | ||
562 | ||
563 | ext = Extension('_iewin', ['%s/IEHtmlWin.cpp' % location, | |
564 | '%s/wxactivex.cpp' % location, | |
565 | ] + swig_sources, | |
566 | ||
567 | include_dirs = includes + CONTRIBS_INC, | |
568 | define_macros = defines, | |
569 | ||
570 | library_dirs = libdirs, | |
571 | libraries = libs, | |
572 | ||
573 | extra_compile_args = cflags, | |
574 | extra_link_args = lflags, | |
575 | ) | |
576 | ||
577 | wxpExtensions.append(ext) | |
578 | ||
579 | ||
580 | #---------------------------------------------------------------------- | |
581 | # Define the ACTIVEX extension module (experimental) | |
582 | #---------------------------------------------------------------------- | |
583 | ||
584 | if 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, | |
607 | extra_link_args = lflags, | |
608 | ) | |
609 | ||
610 | wxpExtensions.append(ext) | |
611 | ||
612 | ||
613 | #---------------------------------------------------------------------- | |
614 | # Define the GIZMOS extension module | |
615 | #---------------------------------------------------------------------- | |
616 | ||
617 | if BUILD_GIZMOS: | |
618 | msg('Preparing GIZMOS...') | |
619 | location = 'contrib/gizmos' | |
620 | ||
621 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, | |
622 | USE_SWIG, swig_force, swig_args, swig_deps) | |
623 | ||
624 | ext = Extension('_gizmos', | |
625 | [ '%s/treelistctrl.cpp' % opj(location, 'wxCode/src') ] + swig_sources, | |
626 | ||
627 | include_dirs = includes + [ location, opj(location, 'wxCode/include') ] + CONTRIBS_INC, | |
628 | define_macros = defines, | |
629 | ||
630 | library_dirs = libdirs, | |
631 | libraries = libs + makeLibName('gizmos'), | |
632 | ||
633 | extra_compile_args = cflags, | |
634 | extra_link_args = lflags, | |
635 | ) | |
636 | ||
637 | wxpExtensions.append(ext) | |
638 | ||
639 | ||
640 | ||
641 | #---------------------------------------------------------------------- | |
642 | # Define the DLLWIDGET extension module | |
643 | #---------------------------------------------------------------------- | |
644 | ||
645 | if BUILD_DLLWIDGET: | |
646 | msg('Preparing DLLWIDGET...') | |
647 | location = 'contrib/dllwidget' | |
648 | swig_files = ['dllwidget_.i'] | |
649 | ||
650 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
651 | USE_SWIG, swig_force, swig_args, swig_deps) | |
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) | |
655 | CLEANUP.append(opj(PKGDIR, 'dllwidget.py')) | |
656 | ||
657 | ext = Extension('dllwidget_c', [ | |
658 | '%s/dllwidget.cpp' % location, | |
659 | ] + swig_sources, | |
660 | ||
661 | include_dirs = includes + CONTRIBS_INC, | |
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 | ||
674 | ||
675 | ||
676 | #---------------------------------------------------------------------- | |
677 | # Tools, scripts data files, etc. | |
678 | #---------------------------------------------------------------------- | |
679 | ||
680 | if NO_SCRIPTS: | |
681 | SCRIPTS = None | |
682 | else: | |
683 | SCRIPTS = [opj('scripts/helpviewer'), | |
684 | opj('scripts/img2png'), | |
685 | opj('scripts/img2py'), | |
686 | opj('scripts/img2xpm'), | |
687 | opj('scripts/pyalacarte'), | |
688 | opj('scripts/pyalamode'), | |
689 | opj('scripts/pycrust'), | |
690 | opj('scripts/pyshell'), | |
691 | opj('scripts/pywrap'), | |
692 | opj('scripts/pywrap'), | |
693 | opj('scripts/pywxrc'), | |
694 | opj('scripts/xrced'), | |
695 | ] | |
696 | ||
697 | ||
698 | ||
699 | DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc') | |
700 | DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html') | |
701 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') | |
702 | ||
703 | ||
704 | if NO_HEADERS: | |
705 | HEADERS = None | |
706 | else: | |
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 | ||
712 | HEADERS = zip(h_files, ["/wxPython"]*len(h_files)) + \ | |
713 | zip(i_files, ["/wxPython/i_files"]*len(i_files)) | |
714 | ||
715 | ||
716 | ||
717 | if INSTALL_MULTIVERSION: | |
718 | EXTRA_PATH = getExtraPath(addOpts=EP_ADD_OPTS) | |
719 | open("src/wx.pth", "w").write(EXTRA_PATH) | |
720 | CLEANUP.append("src/wx.pth") | |
721 | else: | |
722 | EXTRA_PATH = None | |
723 | ||
724 | ||
725 | ||
726 | #---------------------------------------------------------------------- | |
727 | # Do the Setup/Build/Install/Whatever | |
728 | #---------------------------------------------------------------------- | |
729 | ||
730 | if __name__ == "__main__": | |
731 | if not PREP_ONLY: | |
732 | ||
733 | setup(name = 'wxPython', | |
734 | version = VERSION, | |
735 | description = DESCRIPTION, | |
736 | long_description = LONG_DESCRIPTION, | |
737 | author = AUTHOR, | |
738 | author_email = AUTHOR_EMAIL, | |
739 | url = URL, | |
740 | download_url = DOWNLOAD_URL, | |
741 | license = LICENSE, | |
742 | platforms = PLATFORMS, | |
743 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
744 | keywords = KEYWORDS, | |
745 | ||
746 | packages = ['wxPython', | |
747 | 'wxPython.lib', | |
748 | 'wxPython.lib.colourchooser', | |
749 | 'wxPython.lib.editor', | |
750 | 'wxPython.lib.mixins', | |
751 | 'wxPython.tools', | |
752 | ||
753 | 'wx', | |
754 | 'wx.build', | |
755 | 'wx.lib', | |
756 | 'wx.lib.colourchooser', | |
757 | 'wx.lib.editor', | |
758 | 'wx.lib.floatcanvas', | |
759 | 'wx.lib.masked', | |
760 | 'wx.lib.mixins', | |
761 | 'wx.lib.ogl', | |
762 | 'wx.py', | |
763 | 'wx.tools', | |
764 | 'wx.tools.XRCed', | |
765 | ], | |
766 | ||
767 | extra_path = EXTRA_PATH, | |
768 | ||
769 | ext_package = PKGDIR, | |
770 | ext_modules = wxpExtensions, | |
771 | ||
772 | options = { 'build' : { 'build_base' : BUILD_BASE }, | |
773 | }, | |
774 | ||
775 | scripts = SCRIPTS, | |
776 | data_files = DATA_FILES, | |
777 | headers = HEADERS, | |
778 | ||
779 | # Override some of the default distutils command classes with my own | |
780 | cmdclass = { 'install' : wx_install, | |
781 | 'install_data': wx_smart_install_data, | |
782 | 'install_headers': wx_install_headers, | |
783 | 'clean': wx_extra_clean, | |
784 | }, | |
785 | ) | |
786 | ||
787 | ||
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 | ||
814 | #---------------------------------------------------------------------- | |
815 | #---------------------------------------------------------------------- |