]>
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, os | |
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 wish to be wxPython compatible. | |
21 | # The 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 | # To fully support external builds, we need to have a build options | |
33 | # file that is created whenever a new wxPython build is performed. | |
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. | |
36 | ||
37 | for bo_name in ["build_options.py", "build_options.pyc"]: | |
38 | if os.path.exists(bo_name): | |
39 | os.remove(bo_name) | |
40 | ||
41 | sys.setup_is_main = __name__ == "__main__" # an icky hack! | |
42 | from config import * | |
43 | ||
44 | ||
45 | #---------------------------------------------------------------------- | |
46 | # Update the packaged config file. | |
47 | #---------------------------------------------------------------------- | |
48 | ||
49 | copy_file('config.py', 'wx/build', update=1, verbose=1) | |
50 | copy_file('build_options.py', 'wx/build', update=1, verbose=1) | |
51 | CLEANUP.append('wx/build/config.py') | |
52 | CLEANUP.append('wx/build/build_options.py') | |
53 | ||
54 | #---------------------------------------------------------------------- | |
55 | # Update the version file | |
56 | #---------------------------------------------------------------------- | |
57 | ||
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 | ||
61 | open('wx/__version__.py', 'w').write("""\ | |
62 | # This file was generated by setup.py... | |
63 | ||
64 | VERSION_STRING = '%(VERSION)s' | |
65 | MAJOR_VERSION = %(VER_MAJOR)s | |
66 | MINOR_VERSION = %(VER_MINOR)s | |
67 | RELEASE_VERSION = %(VER_RELEASE)s | |
68 | SUBREL_VERSION = %(VER_SUBREL)s | |
69 | ||
70 | VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION, | |
71 | SUBREL_VERSION, '%(VER_FLAGS)s') | |
72 | ||
73 | RELEASE_NUMBER = RELEASE_VERSION # for compatibility | |
74 | """ % globals()) | |
75 | ||
76 | CLEANUP.append('wx/__version__.py') | |
77 | ||
78 | ||
79 | #---------------------------------------------------------------------- | |
80 | # Write the SWIG version to a header file | |
81 | #---------------------------------------------------------------------- | |
82 | ||
83 | if USE_SWIG: | |
84 | try: | |
85 | SVER = swig_version() | |
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) | |
92 | except: | |
93 | msg('\nUnable to get SWIG version number\n') | |
94 | ||
95 | ||
96 | ||
97 | #---------------------------------------------------------------------- | |
98 | # patch distutils if it can't cope with the "classifiers" or | |
99 | # "download_url" keywords | |
100 | #---------------------------------------------------------------------- | |
101 | ||
102 | if sys.version < '2.2.3': | |
103 | from distutils.dist import DistributionMetadata | |
104 | DistributionMetadata.classifiers = None | |
105 | DistributionMetadata.download_url = None | |
106 | depends = {} | |
107 | else: | |
108 | depends = {'depends' : depends} | |
109 | ||
110 | ||
111 | #---------------------------------------------------------------------- | |
112 | # Define the CORE extension module | |
113 | #---------------------------------------------------------------------- | |
114 | ||
115 | msg('Preparing CORE...') | |
116 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, | |
117 | USE_SWIG, swig_force, swig_args, swig_deps + | |
118 | [ 'src/_accel.i', | |
119 | 'src/_app.i', | |
120 | 'src/_app_ex.py', | |
121 | 'src/_constraints.i', | |
122 | 'src/_core_api.i', | |
123 | 'src/_core_ex.py', | |
124 | 'src/__core_rename.i', | |
125 | 'src/__core_reverse.txt', | |
126 | 'src/_defs.i', | |
127 | 'src/_event.i', | |
128 | 'src/_event_ex.py', | |
129 | 'src/_evtloop.i', | |
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', | |
141 | 'src/_control.i', | |
142 | 'src/_swigtype.i', | |
143 | ], | |
144 | True) | |
145 | ||
146 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) | |
147 | CLEANUP.append(opj(PKGDIR, '__init__.py')) | |
148 | ||
149 | ||
150 | # update the license files | |
151 | mkpath('licence') | |
152 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
153 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
154 | CLEANUP.append(opj('licence',file)) | |
155 | CLEANUP.append('licence') | |
156 | ||
157 | ||
158 | if os.name == 'nt': | |
159 | build_locale_dir(opj(PKGDIR, 'locale')) | |
160 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
161 | ||
162 | ||
163 | if os.name == 'nt': | |
164 | rc_file = ['src/wxc.rc'] | |
165 | else: | |
166 | rc_file = [] | |
167 | ||
168 | ||
169 | ext = Extension('_core_', ['src/helpers.cpp', | |
170 | ] + rc_file + swig_sources, | |
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, | |
180 | ||
181 | **depends | |
182 | ) | |
183 | wxpExtensions.append(ext) | |
184 | ||
185 | ||
186 | ||
187 | ||
188 | ||
189 | # Extension for the GDI module | |
190 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
191 | USE_SWIG, swig_force, swig_args, swig_deps + | |
192 | ['src/__gdi_rename.i', | |
193 | 'src/_bitmap.i', | |
194 | 'src/_colour.i', | |
195 | 'src/_dc.i', | |
196 | 'src/_graphics.i', | |
197 | 'src/_overlay.i', | |
198 | 'src/_gdiobj.i', | |
199 | 'src/_imaglist.i', | |
200 | 'src/_region.i', | |
201 | 'src/_stockobjs.i', | |
202 | 'src/_effects.i', | |
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', | |
211 | 'src/_renderer.i', | |
212 | 'src/_pseudodc.i', | |
213 | ], | |
214 | True) | |
215 | ext = Extension('_gdi_', ['src/drawlist.cpp', | |
216 | 'src/pseudodc.cpp' | |
217 | ] + 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 | ||
232 | ||
233 | # Extension for the windows module | |
234 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
235 | USE_SWIG, swig_force, swig_args, swig_deps + | |
236 | ['src/__windows_rename.i', | |
237 | 'src/__windows_reverse.txt', | |
238 | 'src/_panel.i', | |
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', | |
251 | ], | |
252 | True) | |
253 | ext = Extension('_windows_', swig_sources, | |
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, | |
260 | **depends | |
261 | ) | |
262 | wxpExtensions.append(ext) | |
263 | ||
264 | ||
265 | ||
266 | ||
267 | # Extension for the controls module | |
268 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
269 | USE_SWIG, swig_force, swig_args, swig_deps + | |
270 | [ 'src/__controls_rename.i', | |
271 | 'src/__controls_reverse.txt', | |
272 | 'src/_toolbar.i', | |
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', | |
293 | 'src/_datectrl.i', | |
294 | 'src/_hyperlink.i', | |
295 | 'src/_picker.i', | |
296 | ], | |
297 | True) | |
298 | ext = Extension('_controls_', 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 | # Extension for the misc module | |
313 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
314 | USE_SWIG, swig_force, swig_args, swig_deps + | |
315 | [ 'src/__misc_rename.i', | |
316 | 'src/__misc_reverse.txt', | |
317 | 'src/_settings.i', | |
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', | |
333 | 'src/_clipbrd.i', | |
334 | 'src/_stdpaths.i', | |
335 | 'src/_power.i', | |
336 | 'src/_about.i', | |
337 | ], | |
338 | True) | |
339 | ext = Extension('_misc_', swig_sources, | |
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, | |
346 | **depends | |
347 | ) | |
348 | wxpExtensions.append(ext) | |
349 | ||
350 | ||
351 | ||
352 | ## | |
353 | ## Core modules that are not in the "core" namespace start here | |
354 | ## | |
355 | ||
356 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, | |
357 | USE_SWIG, swig_force, swig_args, swig_deps) | |
358 | ext = 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, | |
365 | **depends | |
366 | ) | |
367 | wxpExtensions.append(ext) | |
368 | ||
369 | ||
370 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
371 | USE_SWIG, swig_force, swig_args, swig_deps) | |
372 | ext = Extension('_grid', swig_sources, | |
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, | |
379 | **depends | |
380 | ) | |
381 | wxpExtensions.append(ext) | |
382 | ||
383 | ||
384 | ||
385 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
386 | USE_SWIG, swig_force, swig_args, swig_deps) | |
387 | ext = Extension('_html', swig_sources, | |
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, | |
394 | **depends | |
395 | ) | |
396 | wxpExtensions.append(ext) | |
397 | ||
398 | ||
399 | mediaLibs = libs[:] | |
400 | if not MONOLITHIC: | |
401 | mediaLibs += makeLibName('media') | |
402 | swig_sources = run_swig(['media.i'], 'src', GENDIR, PKGDIR, | |
403 | USE_SWIG, swig_force, swig_args, swig_deps) | |
404 | ext = Extension('_media', swig_sources, | |
405 | include_dirs = includes, | |
406 | define_macros = defines, | |
407 | library_dirs = libdirs, | |
408 | libraries = mediaLibs, | |
409 | extra_compile_args = cflags, | |
410 | extra_link_args = lflags, | |
411 | **depends | |
412 | ) | |
413 | wxpExtensions.append(ext) | |
414 | ||
415 | ||
416 | swig_sources = run_swig(['webkit.i'], 'src', GENDIR, PKGDIR, | |
417 | USE_SWIG, swig_force, swig_args, swig_deps) | |
418 | ext = 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 | ) | |
427 | wxpExtensions.append(ext) | |
428 | ||
429 | ||
430 | ||
431 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, | |
432 | USE_SWIG, swig_force, swig_args, swig_deps) | |
433 | ext = Extension('_wizard', swig_sources, | |
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, | |
440 | **depends | |
441 | ) | |
442 | wxpExtensions.append(ext) | |
443 | ||
444 | ||
445 | ||
446 | swig_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 | ]) | |
455 | if not MONOLITHIC: | |
456 | xrcLib = makeLibName('xrc') | |
457 | else: | |
458 | xrcLib = [] | |
459 | ext = Extension('_xrc', | |
460 | swig_sources, | |
461 | ||
462 | include_dirs = includes + CONTRIBS_INC, | |
463 | define_macros = defines, | |
464 | ||
465 | library_dirs = libdirs, | |
466 | libraries = libs + xrcLib, | |
467 | ||
468 | extra_compile_args = cflags, | |
469 | extra_link_args = lflags, | |
470 | ) | |
471 | wxpExtensions.append(ext) | |
472 | ||
473 | ||
474 | ||
475 | swig_sources = run_swig(['richtext.i'], 'src', GENDIR, PKGDIR, | |
476 | USE_SWIG, swig_force, swig_args, swig_deps) | |
477 | if not MONOLITHIC: | |
478 | richLib = makeLibName('richtext') | |
479 | else: | |
480 | richLib = [] | |
481 | ext = Extension('_richtext', swig_sources, | |
482 | include_dirs = includes, | |
483 | define_macros = defines, | |
484 | library_dirs = libdirs, | |
485 | libraries = libs + richLib, | |
486 | extra_compile_args = cflags, | |
487 | extra_link_args = lflags, | |
488 | **depends | |
489 | ) | |
490 | wxpExtensions.append(ext) | |
491 | ||
492 | ||
493 | ||
494 | swig_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'), | |
501 | opj(WXDIR, 'include/wx/aui/auibook.h'), | |
502 | ]) | |
503 | if not MONOLITHIC: | |
504 | auiLib = makeLibName('aui') | |
505 | else: | |
506 | auiLib = [] | |
507 | ext = 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, | |
513 | extra_link_args = lflags, | |
514 | **depends | |
515 | ) | |
516 | wxpExtensions.append(ext) | |
517 | ||
518 | ||
519 | swig_sources = run_swig(['animate.i'], 'src', GENDIR, PKGDIR, | |
520 | USE_SWIG, swig_force, swig_args, swig_deps) | |
521 | ext = 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 | ||
534 | wxpExtensions.append(ext) | |
535 | ||
536 | ||
537 | ||
538 | ||
539 | #---------------------------------------------------------------------- | |
540 | # Define the GLCanvas extension module | |
541 | #---------------------------------------------------------------------- | |
542 | ||
543 | if BUILD_GLCANVAS: | |
544 | msg('Preparing GLCANVAS...') | |
545 | location = 'contrib/glcanvas' | |
546 | ||
547 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, | |
548 | USE_SWIG, swig_force, swig_args, swig_deps) | |
549 | ||
550 | gl_libs = [] | |
551 | gl_libdirs = libdirs[:] | |
552 | if os.name == 'posix': | |
553 | gl_config = os.popen(WX_CONFIG + ' --libs gl', 'r').read()[:-1] | |
554 | gl_lflags = gl_config.split() | |
555 | gl_lflags = adjustLFLAGS(gl_lflags, gl_libdirs, gl_libs) | |
556 | ||
557 | ||
558 | else: | |
559 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') | |
560 | gl_lflags = lflags | |
561 | ||
562 | ext = Extension('_glcanvas', | |
563 | swig_sources, | |
564 | ||
565 | include_dirs = includes + CONTRIBS_INC, | |
566 | define_macros = defines, | |
567 | ||
568 | library_dirs = gl_libdirs, | |
569 | libraries = gl_libs, | |
570 | ||
571 | extra_compile_args = cflags, | |
572 | extra_link_args = gl_lflags, | |
573 | ) | |
574 | ||
575 | wxpExtensions.append(ext) | |
576 | ||
577 | ||
578 | #---------------------------------------------------------------------- | |
579 | # Define the OGL extension module | |
580 | #---------------------------------------------------------------------- | |
581 | ||
582 | if BUILD_OGL: | |
583 | msg('Preparing OGL...') | |
584 | location = 'contrib/ogl' | |
585 | ||
586 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, | |
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 | ]) | |
594 | ||
595 | ext = Extension('_ogl', | |
596 | swig_sources, | |
597 | ||
598 | include_dirs = includes + [ location ] + CONTRIBS_INC, | |
599 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], | |
600 | ||
601 | library_dirs = libdirs, | |
602 | libraries = libs + makeLibName('ogl'), | |
603 | ||
604 | extra_compile_args = cflags, | |
605 | extra_link_args = lflags, | |
606 | ) | |
607 | ||
608 | wxpExtensions.append(ext) | |
609 | ||
610 | ||
611 | ||
612 | #---------------------------------------------------------------------- | |
613 | # Define the STC extension module | |
614 | #---------------------------------------------------------------------- | |
615 | ||
616 | if BUILD_STC: | |
617 | msg('Preparing STC...') | |
618 | location = 'contrib/stc' | |
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)) | |
623 | ||
624 | ## NOTE: need to add something like this to the stc.bkl... | |
625 | ||
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'))): | |
630 | ||
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) | |
638 | ||
639 | ||
640 | swig_sources = run_swig(['stc.i'], location, GENDIR, PKGDIR, | |
641 | USE_SWIG, swig_force, | |
642 | swig_args + ['-I'+STC_H, '-I'+location], | |
643 | [opj(STC_H, 'stc.h'), | |
644 | opj(location, "_stc_utf8_methods.py"), | |
645 | opj(location, "_stc_docstrings.i"), | |
646 | opj(location, "_stc_gendocs.i"), | |
647 | ] + swig_deps) | |
648 | ||
649 | ext = Extension('_stc', | |
650 | swig_sources, | |
651 | ||
652 | include_dirs = includes + CONTRIBS_INC, | |
653 | define_macros = defines, | |
654 | ||
655 | library_dirs = libdirs, | |
656 | libraries = libs + makeLibName('stc'), | |
657 | ||
658 | extra_compile_args = cflags, | |
659 | extra_link_args = lflags, | |
660 | ) | |
661 | ||
662 | wxpExtensions.append(ext) | |
663 | ||
664 | ||
665 | #---------------------------------------------------------------------- | |
666 | # Define the ACTIVEX extension module (experimental) | |
667 | #---------------------------------------------------------------------- | |
668 | ||
669 | if 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, | |
692 | extra_link_args = lflags, | |
693 | ) | |
694 | ||
695 | wxpExtensions.append(ext) | |
696 | ||
697 | ||
698 | #---------------------------------------------------------------------- | |
699 | # Define the GIZMOS extension module | |
700 | #---------------------------------------------------------------------- | |
701 | ||
702 | if BUILD_GIZMOS: | |
703 | msg('Preparing GIZMOS...') | |
704 | location = 'contrib/gizmos' | |
705 | ||
706 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, | |
707 | USE_SWIG, swig_force, swig_args, swig_deps + | |
708 | [ '%s/_treelist.i' % location]) | |
709 | ||
710 | ext = Extension('_gizmos', | |
711 | [ '%s/treelistctrl.cpp' % opj(location, 'wxCode/src') ] + swig_sources, | |
712 | ||
713 | include_dirs = includes + [ location, opj(location, 'wxCode/include') ] + CONTRIBS_INC, | |
714 | define_macros = defines, | |
715 | ||
716 | library_dirs = libdirs, | |
717 | libraries = libs + makeLibName('gizmos'), | |
718 | ||
719 | extra_compile_args = cflags, | |
720 | extra_link_args = lflags, | |
721 | ) | |
722 | ||
723 | wxpExtensions.append(ext) | |
724 | ||
725 | ||
726 | #---------------------------------------------------------------------- | |
727 | # Define the DLLWIDGET extension module | |
728 | #---------------------------------------------------------------------- | |
729 | ||
730 | if BUILD_DLLWIDGET: | |
731 | msg('Preparing DLLWIDGET...') | |
732 | location = 'contrib/dllwidget' | |
733 | swig_files = ['dllwidget_.i'] | |
734 | ||
735 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
736 | USE_SWIG, swig_force, swig_args, swig_deps) | |
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) | |
740 | CLEANUP.append(opj(PKGDIR, 'dllwidget.py')) | |
741 | ||
742 | ext = Extension('dllwidget_c', [ | |
743 | '%s/dllwidget.cpp' % location, | |
744 | ] + swig_sources, | |
745 | ||
746 | include_dirs = includes + CONTRIBS_INC, | |
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 | ||
759 | ||
760 | ||
761 | #---------------------------------------------------------------------- | |
762 | # Tools, scripts data files, etc. | |
763 | #---------------------------------------------------------------------- | |
764 | ||
765 | if NO_SCRIPTS: | |
766 | SCRIPTS = None | |
767 | else: | |
768 | SCRIPTS = [opj('scripts/helpviewer'), | |
769 | opj('scripts/img2png'), | |
770 | opj('scripts/img2py'), | |
771 | opj('scripts/img2xpm'), | |
772 | opj('scripts/pyalacarte'), | |
773 | opj('scripts/pyalamode'), | |
774 | opj('scripts/pycrust'), | |
775 | opj('scripts/pyshell'), | |
776 | opj('scripts/pywrap'), | |
777 | opj('scripts/pywrap'), | |
778 | opj('scripts/pywxrc'), | |
779 | opj('scripts/xrced'), | |
780 | ] | |
781 | ||
782 | ||
783 | ||
784 | DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc') | |
785 | DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html') | |
786 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') | |
787 | ||
788 | ||
789 | if NO_HEADERS: | |
790 | HEADERS = None | |
791 | else: | |
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")) | |
796 | if BUILD_GLCANVAS: | |
797 | i_files += glob.glob(opj("contrib/glcanvas/*.i")) | |
798 | ||
799 | HEADERS = zip(h_files, ["/wxPython"]*len(h_files)) + \ | |
800 | zip(i_files, ["/wxPython/i_files"]*len(i_files)) | |
801 | ||
802 | ||
803 | ||
804 | if INSTALL_MULTIVERSION: | |
805 | EXTRA_PATH = getExtraPath(addOpts=EP_ADD_OPTS, shortVer=not EP_FULL_VER) | |
806 | open("src/wx.pth", "w").write(EXTRA_PATH) | |
807 | CLEANUP.append("src/wx.pth") | |
808 | else: | |
809 | EXTRA_PATH = None | |
810 | ||
811 | ||
812 | ||
813 | #---------------------------------------------------------------------- | |
814 | # Do the Setup/Build/Install/Whatever | |
815 | #---------------------------------------------------------------------- | |
816 | ||
817 | if __name__ == "__main__": | |
818 | if not PREP_ONLY: | |
819 | ||
820 | setup(name = 'wxPython', | |
821 | version = VERSION, | |
822 | description = DESCRIPTION, | |
823 | long_description = LONG_DESCRIPTION, | |
824 | author = AUTHOR, | |
825 | author_email = AUTHOR_EMAIL, | |
826 | url = URL, | |
827 | download_url = DOWNLOAD_URL, | |
828 | license = LICENSE, | |
829 | platforms = PLATFORMS, | |
830 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
831 | keywords = KEYWORDS, | |
832 | ||
833 | packages = ['wxPython', | |
834 | 'wxPython.lib', | |
835 | 'wxPython.lib.colourchooser', | |
836 | 'wxPython.lib.editor', | |
837 | 'wxPython.lib.mixins', | |
838 | 'wxPython.tools', | |
839 | ||
840 | 'wx', | |
841 | 'wx.build', | |
842 | 'wx.lib', | |
843 | 'wx.lib.analogclock', | |
844 | 'wx.lib.analogclock.lib_setup', | |
845 | 'wx.lib.colourchooser', | |
846 | 'wx.lib.editor', | |
847 | 'wx.lib.floatcanvas', | |
848 | 'wx.lib.masked', | |
849 | 'wx.lib.mixins', | |
850 | 'wx.lib.ogl', | |
851 | 'wx.py', | |
852 | 'wx.tools', | |
853 | 'wx.tools.XRCed', | |
854 | ], | |
855 | ||
856 | extra_path = EXTRA_PATH, | |
857 | ||
858 | ext_package = PKGDIR, | |
859 | ext_modules = wxpExtensions, | |
860 | ||
861 | options = { 'build' : { 'build_base' : BUILD_BASE }, | |
862 | }, | |
863 | ||
864 | scripts = SCRIPTS, | |
865 | data_files = DATA_FILES, | |
866 | headers = HEADERS, | |
867 | ||
868 | # Override some of the default distutils command classes with my own | |
869 | cmdclass = { 'install' : wx_install, | |
870 | 'install_data': wx_smart_install_data, | |
871 | 'install_headers': wx_install_headers, | |
872 | 'clean': wx_extra_clean, | |
873 | }, | |
874 | ) | |
875 | ||
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 | ) | |
891 | ||
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 | ||
918 | #---------------------------------------------------------------------- | |
919 | #---------------------------------------------------------------------- |