]>
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 | |
1b62f00d RD |
68 | #---------------------------------------------------------------------- |
69 | # Define the CORE extension module | |
70 | #---------------------------------------------------------------------- | |
71 | ||
1e4a197e | 72 | msg('Preparing CORE...') |
d14a1e28 RD |
73 | swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR, |
74 | USE_SWIG, swig_force, swig_args, swig_deps + | |
1e0c8722 RD |
75 | [ 'src/_accel.i', |
76 | 'src/_app.i', | |
d14a1e28 RD |
77 | 'src/_app_ex.py', |
78 | 'src/_constraints.i', | |
79 | 'src/_core_api.i', | |
80 | 'src/_core_ex.py', | |
81 | 'src/_core_rename.i', | |
82 | 'src/_core_reverse.txt', | |
83 | 'src/_defs.i', | |
84 | 'src/_event.i', | |
85 | 'src/_event_ex.py', | |
86 | 'src/_evthandler.i', | |
87 | 'src/_filesys.i', | |
88 | 'src/_gdicmn.i', | |
89 | 'src/_image.i', | |
90 | 'src/_menu.i', | |
91 | 'src/_obj.i', | |
92 | 'src/_sizers.i', | |
93 | 'src/_gbsizer.i', | |
94 | 'src/_streams.i', | |
95 | 'src/_validator.i', | |
96 | 'src/_window.i', | |
99abd512 | 97 | 'src/_control.i', |
d14a1e28 | 98 | ]) |
1b62f00d | 99 | |
1e4a197e | 100 | copy_file('src/__init__.py', PKGDIR, update=1, verbose=0) |
99abd512 | 101 | CLEANUP.append(opj(PKGDIR, '__init__.py')) |
1b62f00d RD |
102 | |
103 | ||
d14a1e28 RD |
104 | # update the license files |
105 | mkpath('licence') | |
106 | for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: | |
107 | copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0) | |
99abd512 RD |
108 | CLEANUP.append(opj('licence',file)) |
109 | CLEANUP.append('licence') | |
c368d904 | 110 | |
c368d904 | 111 | |
1e4a197e RD |
112 | if os.name == 'nt': |
113 | build_locale_dir(opj(PKGDIR, 'locale')) | |
114 | DATA_FILES += build_locale_list(opj(PKGDIR, 'locale')) | |
4f3449b4 RD |
115 | |
116 | ||
1e4a197e RD |
117 | if os.name == 'nt': |
118 | rc_file = ['src/wxc.rc'] | |
119 | else: | |
120 | rc_file = [] | |
121 | ||
122 | ||
d14a1e28 RD |
123 | ext = Extension('_core', ['src/helpers.cpp', |
124 | 'src/libpy.c', | |
1e4a197e RD |
125 | ] + rc_file + swig_sources, |
126 | ||
127 | include_dirs = includes, | |
128 | define_macros = defines, | |
129 | ||
130 | library_dirs = libdirs, | |
131 | libraries = libs, | |
132 | ||
133 | extra_compile_args = cflags, | |
134 | extra_link_args = lflags, | |
d14a1e28 RD |
135 | |
136 | depends = depends | |
1e4a197e RD |
137 | ) |
138 | wxpExtensions.append(ext) | |
139 | ||
140 | ||
d14a1e28 RD |
141 | |
142 | ||
143 | ||
144 | # Extension for the GDI module | |
145 | swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR, | |
146 | USE_SWIG, swig_force, swig_args, swig_deps + | |
147 | ['src/_gdi_rename.i', | |
99abd512 RD |
148 | 'src/_bitmap.i', |
149 | 'src/_colour.i', | |
150 | 'src/_dc.i', | |
151 | 'src/_gdiobj.i', | |
152 | 'src/_imaglist.i', | |
153 | 'src/_region.i', | |
154 | 'src/_stockobjs.i', | |
d14a1e28 | 155 | 'src/_effects.i', |
99abd512 RD |
156 | 'src/_intl.i', |
157 | 'src/_intl_ex.py', | |
158 | 'src/_brush.i', | |
159 | 'src/_cursor.i', | |
160 | 'src/_font.i', | |
161 | 'src/_icon.i', | |
162 | 'src/_pen.i', | |
163 | 'src/_palette.i', | |
164 | ]) | |
d14a1e28 | 165 | ext = Extension('_gdi', ['src/drawlist.cpp'] + swig_sources, |
1e4a197e RD |
166 | include_dirs = includes, |
167 | define_macros = defines, | |
168 | library_dirs = libdirs, | |
169 | libraries = libs, | |
170 | extra_compile_args = cflags, | |
171 | extra_link_args = lflags, | |
d14a1e28 | 172 | depends = depends |
1e4a197e RD |
173 | ) |
174 | wxpExtensions.append(ext) | |
175 | ||
176 | ||
d14a1e28 RD |
177 | |
178 | ||
179 | ||
180 | ||
181 | # Extension for the windows module | |
182 | swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR, | |
183 | USE_SWIG, swig_force, swig_args, swig_deps + | |
99abd512 RD |
184 | ['src/_windows_rename.i', |
185 | 'src/_windows_reverse.txt', | |
d14a1e28 | 186 | 'src/_panel.i', |
99abd512 RD |
187 | 'src/_toplvl.i', |
188 | 'src/_statusbar.i', | |
189 | 'src/_splitter.i', | |
190 | 'src/_sashwin.i', | |
191 | 'src/_popupwin.i', | |
192 | 'src/_tipwin.i', | |
193 | 'src/_vscroll.i', | |
194 | 'src/_taskbar.i', | |
195 | 'src/_cmndlgs.i', | |
196 | 'src/_mdi.i', | |
197 | 'src/_pywindows.i', | |
198 | 'src/_printfw.i', | |
199 | ]) | |
d14a1e28 | 200 | ext = Extension('_windows', swig_sources, |
1e4a197e RD |
201 | include_dirs = includes, |
202 | define_macros = defines, | |
203 | library_dirs = libdirs, | |
204 | libraries = libs, | |
205 | extra_compile_args = cflags, | |
206 | extra_link_args = lflags, | |
d14a1e28 | 207 | depends = depends |
1e4a197e RD |
208 | ) |
209 | wxpExtensions.append(ext) | |
210 | ||
211 | ||
d14a1e28 RD |
212 | |
213 | ||
214 | # Extension for the controls module | |
215 | swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR, | |
216 | USE_SWIG, swig_force, swig_args, swig_deps + | |
99abd512 RD |
217 | [ 'src/_controls_rename.i', |
218 | 'src/_controls_reverse.txt', | |
cf636c45 | 219 | 'src/_toolbar.i', |
99abd512 RD |
220 | 'src/_button.i', |
221 | 'src/_checkbox.i', | |
222 | 'src/_choice.i', | |
223 | 'src/_combobox.i', | |
224 | 'src/_gauge.i', | |
225 | 'src/_statctrls.i', | |
226 | 'src/_listbox.i', | |
227 | 'src/_textctrl.i', | |
228 | 'src/_scrolbar.i', | |
229 | 'src/_spin.i', | |
230 | 'src/_radio.i', | |
231 | 'src/_slider.i', | |
232 | 'src/_tglbtn.i', | |
233 | 'src/_notebook.i', | |
234 | 'src/_listctrl.i', | |
235 | 'src/_treectrl.i', | |
236 | 'src/_dirctrl.i', | |
237 | 'src/_pycontrol.i', | |
238 | 'src/_cshelp.i', | |
239 | 'src/_dragimg.i', | |
d14a1e28 RD |
240 | ]) |
241 | ext = Extension('_controls', swig_sources, | |
242 | include_dirs = includes, | |
243 | define_macros = defines, | |
244 | library_dirs = libdirs, | |
245 | libraries = libs, | |
246 | extra_compile_args = cflags, | |
247 | extra_link_args = lflags, | |
248 | depends = depends | |
249 | ) | |
250 | wxpExtensions.append(ext) | |
251 | ||
252 | ||
253 | ||
254 | ||
255 | # Extension for the misc module | |
256 | swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR, | |
257 | USE_SWIG, swig_force, swig_args, swig_deps + | |
99abd512 RD |
258 | [ 'src/_settings.i', |
259 | 'src/_functions.i', | |
260 | 'src/_misc.i', | |
261 | 'src/_tipdlg.i', | |
262 | 'src/_timer.i', | |
263 | 'src/_log.i', | |
264 | 'src/_process.i', | |
265 | 'src/_joystick.i', | |
266 | 'src/_sound.i', | |
267 | 'src/_mimetype.i', | |
268 | 'src/_artprov.i', | |
269 | 'src/_config.i', | |
270 | 'src/_datetime.i', | |
271 | 'src/_dataobj.i', | |
272 | 'src/_dnd.i', | |
273 | 'src/_display.i', | |
d14a1e28 RD |
274 | 'src/_clipbrd.i', |
275 | ]) | |
276 | ext = Extension('_misc', swig_sources, | |
277 | include_dirs = includes, | |
278 | define_macros = defines, | |
279 | library_dirs = libdirs, | |
280 | libraries = libs, | |
281 | extra_compile_args = cflags, | |
282 | extra_link_args = lflags, | |
283 | depends = depends | |
284 | ) | |
285 | wxpExtensions.append(ext) | |
286 | ||
287 | ||
288 | ||
289 | ## | |
290 | ## Core modules that are not in the "core" namespace start here | |
291 | ## | |
292 | ||
1e4a197e RD |
293 | swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR, |
294 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 RD |
295 | ext = Extension('_calendar', swig_sources, |
296 | include_dirs = includes, | |
297 | define_macros = defines, | |
298 | library_dirs = libdirs, | |
299 | libraries = libs, | |
300 | extra_compile_args = cflags, | |
301 | extra_link_args = lflags, | |
302 | depends = depends | |
303 | ) | |
304 | wxpExtensions.append(ext) | |
305 | ||
306 | ||
307 | swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR, | |
308 | USE_SWIG, swig_force, swig_args, swig_deps) | |
309 | ext = Extension('_grid', swig_sources, | |
1e4a197e RD |
310 | include_dirs = includes, |
311 | define_macros = defines, | |
312 | library_dirs = libdirs, | |
313 | libraries = libs, | |
314 | extra_compile_args = cflags, | |
315 | extra_link_args = lflags, | |
d14a1e28 | 316 | depends = depends |
1e4a197e RD |
317 | ) |
318 | wxpExtensions.append(ext) | |
319 | ||
320 | ||
d14a1e28 RD |
321 | |
322 | swig_sources = run_swig(['html.i'], 'src', GENDIR, PKGDIR, | |
1e4a197e | 323 | USE_SWIG, swig_force, swig_args, swig_deps) |
d14a1e28 | 324 | ext = Extension('_html', swig_sources, |
1e4a197e RD |
325 | include_dirs = includes, |
326 | define_macros = defines, | |
327 | library_dirs = libdirs, | |
328 | libraries = libs, | |
329 | extra_compile_args = cflags, | |
330 | extra_link_args = lflags, | |
d14a1e28 | 331 | depends = depends |
1e4a197e RD |
332 | ) |
333 | wxpExtensions.append(ext) | |
334 | ||
335 | ||
d14a1e28 | 336 | |
1e4a197e RD |
337 | swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR, |
338 | USE_SWIG, swig_force, swig_args, swig_deps) | |
d14a1e28 | 339 | ext = Extension('_wizard', swig_sources, |
1e4a197e 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, | |
d14a1e28 | 346 | depends = depends |
1e4a197e RD |
347 | ) |
348 | wxpExtensions.append(ext) | |
af83019e RD |
349 | |
350 | ||
c368d904 RD |
351 | #---------------------------------------------------------------------- |
352 | # Define the GLCanvas extension module | |
353 | #---------------------------------------------------------------------- | |
354 | ||
1e4a197e | 355 | if BUILD_GLCANVAS: |
cfe766c3 | 356 | msg('Preparing GLCANVAS...') |
c368d904 | 357 | location = 'contrib/glcanvas' |
c368d904 | 358 | |
d14a1e28 | 359 | swig_sources = run_swig(['glcanvas.i'], location, GENDIR, PKGDIR, |
10ef30eb | 360 | USE_SWIG, swig_force, swig_args, swig_deps) |
c368d904 RD |
361 | |
362 | gl_libs = [] | |
363 | if os.name == 'posix': | |
f32afe1c | 364 | gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] |
1e4a197e | 365 | gl_lflags = gl_config.split() + lflags |
f32afe1c | 366 | gl_libs = libs |
19cf4f80 | 367 | else: |
3e46a8e6 | 368 | gl_libs = libs + ['opengl32', 'glu32'] + makeLibName('gl') |
f32afe1c | 369 | gl_lflags = lflags |
c368d904 | 370 | |
d14a1e28 | 371 | ext = Extension('_glcanvas', |
3e46a8e6 | 372 | swig_sources, |
1e7ecb7b | 373 | |
4c417214 | 374 | include_dirs = includes + CONTRIBS_INC, |
1e7ecb7b RD |
375 | define_macros = defines, |
376 | ||
377 | library_dirs = libdirs, | |
f32afe1c | 378 | libraries = gl_libs, |
1e7ecb7b RD |
379 | |
380 | extra_compile_args = cflags, | |
f32afe1c | 381 | extra_link_args = gl_lflags, |
1e7ecb7b RD |
382 | ) |
383 | ||
384 | wxpExtensions.append(ext) | |
c368d904 RD |
385 | |
386 | ||
387 | #---------------------------------------------------------------------- | |
388 | # Define the OGL extension module | |
389 | #---------------------------------------------------------------------- | |
390 | ||
1e4a197e | 391 | if BUILD_OGL: |
cfe766c3 | 392 | msg('Preparing OGL...') |
c368d904 | 393 | location = 'contrib/ogl' |
c368d904 | 394 | |
a32360e0 | 395 | swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR, |
d14a1e28 RD |
396 | USE_SWIG, swig_force, swig_args, swig_deps + |
397 | [ '%s/_oglbasic.i' % location, | |
398 | '%s/_oglshapes.i' % location, | |
399 | '%s/_oglshapes2.i' % location, | |
400 | '%s/_oglcanvas.i' % location, | |
401 | '%s/_ogldefs.i' % location, | |
402 | ]) | |
c368d904 | 403 | |
d14a1e28 | 404 | ext = Extension('_ogl', |
3ef86e32 | 405 | swig_sources, |
1e7ecb7b | 406 | |
4c417214 | 407 | include_dirs = includes + [ location ] + CONTRIBS_INC, |
dd116e73 | 408 | define_macros = defines + [('wxUSE_DEPRECATED', '0')], |
1e7ecb7b RD |
409 | |
410 | library_dirs = libdirs, | |
3ef86e32 | 411 | libraries = libs + makeLibName('ogl'), |
1e7ecb7b RD |
412 | |
413 | extra_compile_args = cflags, | |
414 | extra_link_args = lflags, | |
415 | ) | |
416 | ||
417 | wxpExtensions.append(ext) | |
418 | ||
419 | ||
c368d904 RD |
420 | |
421 | #---------------------------------------------------------------------- | |
422 | # Define the STC extension module | |
423 | #---------------------------------------------------------------------- | |
424 | ||
1e4a197e | 425 | if BUILD_STC: |
cfe766c3 | 426 | msg('Preparing STC...') |
c368d904 | 427 | location = 'contrib/stc' |
5a2a9da2 RD |
428 | if os.name == 'nt': |
429 | STC_H = opj(WXDIR, 'contrib', 'include/wx/stc') | |
430 | else: | |
431 | STC_H = opj(WXPREFIX, 'include/wx/stc') | |
55c020cf | 432 | |
de7b7fe6 | 433 | ## NOTE: need to add something like this to the stc.bkl... |
55c020cf | 434 | |
3ef86e32 RD |
435 | ## # Check if gen_iface needs to be run for the wxSTC sources |
436 | ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or | |
437 | ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or | |
438 | ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): | |
55c020cf | 439 | |
3ef86e32 RD |
440 | ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') |
441 | ## cwd = os.getcwd() | |
442 | ## os.chdir(opj(CTRB_SRC, 'stc')) | |
443 | ## sys.path.insert(0, os.curdir) | |
444 | ## import gen_iface | |
445 | ## gen_iface.main([]) | |
446 | ## os.chdir(cwd) | |
c368d904 RD |
447 | |
448 | ||
d14a1e28 | 449 | swig_sources = run_swig(['stc.i'], location, '', PKGDIR, |
c368d904 RD |
450 | USE_SWIG, swig_force, |
451 | swig_args + ['-I'+STC_H, '-I'+location], | |
10ef30eb | 452 | [opj(STC_H, 'stc.h')] + swig_deps) |
c368d904 | 453 | |
d14a1e28 | 454 | ext = Extension('_stc', |
3ef86e32 RD |
455 | swig_sources, |
456 | ||
4c417214 | 457 | include_dirs = includes + CONTRIBS_INC, |
3ef86e32 | 458 | define_macros = defines, |
1e7ecb7b RD |
459 | |
460 | library_dirs = libdirs, | |
3ef86e32 | 461 | libraries = libs + makeLibName('stc'), |
c368d904 | 462 | |
1e7ecb7b RD |
463 | extra_compile_args = cflags, |
464 | extra_link_args = lflags, | |
465 | ) | |
466 | ||
467 | wxpExtensions.append(ext) | |
c368d904 RD |
468 | |
469 | ||
470 | ||
926bb76c RD |
471 | #---------------------------------------------------------------------- |
472 | # Define the IEWIN extension module (experimental) | |
473 | #---------------------------------------------------------------------- | |
474 | ||
1e4a197e | 475 | if BUILD_IEWIN: |
cfe766c3 | 476 | msg('Preparing IEWIN...') |
926bb76c RD |
477 | location = 'contrib/iewin' |
478 | ||
479 | swig_files = ['iewin.i', ] | |
480 | ||
481 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 482 | USE_SWIG, swig_force, swig_args, swig_deps) |
926bb76c RD |
483 | |
484 | ||
de7b7fe6 | 485 | ext = Extension('_iewin', ['%s/IEHtmlWin.cpp' % location, |
c731eb47 | 486 | '%s/wxactivex.cpp' % location, |
926bb76c RD |
487 | ] + swig_sources, |
488 | ||
4c417214 | 489 | include_dirs = includes + CONTRIBS_INC, |
926bb76c RD |
490 | define_macros = defines, |
491 | ||
492 | library_dirs = libdirs, | |
493 | libraries = libs, | |
494 | ||
495 | extra_compile_args = cflags, | |
b7c75283 RD |
496 | extra_link_args = lflags, |
497 | ) | |
498 | ||
499 | wxpExtensions.append(ext) | |
500 | ||
501 | ||
502 | #---------------------------------------------------------------------- | |
503 | # Define the ACTIVEX extension module (experimental) | |
504 | #---------------------------------------------------------------------- | |
505 | ||
506 | if BUILD_ACTIVEX: | |
507 | msg('Preparing ACTIVEX...') | |
508 | location = 'contrib/activex' | |
509 | axloc = opj(location, "wxie") | |
510 | ||
511 | swig_files = ['activex.i', ] | |
512 | ||
513 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
514 | USE_SWIG, swig_force, swig_args, swig_deps + | |
515 | [ '%s/_activex_ex.py' % location]) | |
516 | ||
517 | ||
518 | ext = Extension('_activex', ['%s/IEHtmlWin.cpp' % axloc, | |
519 | '%s/wxactivex.cpp' % axloc, | |
520 | ] + swig_sources, | |
521 | ||
522 | include_dirs = includes + [ axloc ], | |
523 | define_macros = defines, | |
524 | ||
525 | library_dirs = libdirs, | |
526 | libraries = libs, | |
527 | ||
528 | extra_compile_args = cflags, | |
926bb76c RD |
529 | extra_link_args = lflags, |
530 | ) | |
531 | ||
532 | wxpExtensions.append(ext) | |
533 | ||
534 | ||
d56cebe7 RD |
535 | #---------------------------------------------------------------------- |
536 | # Define the XRC extension module | |
537 | #---------------------------------------------------------------------- | |
538 | ||
1e4a197e | 539 | if BUILD_XRC: |
cfe766c3 | 540 | msg('Preparing XRC...') |
d56cebe7 | 541 | location = 'contrib/xrc' |
d56cebe7 | 542 | |
d14a1e28 RD |
543 | swig_sources = run_swig(['xrc.i'], location, '', PKGDIR, |
544 | USE_SWIG, swig_force, swig_args, swig_deps + | |
545 | [ '%s/_xrc_rename.i' % location, | |
546 | '%s/_xrc_ex.py' % location, | |
547 | '%s/_xmlres.i' % location, | |
548 | '%s/_xmlsub.i' % location, | |
549 | '%s/_xml.i' % location, | |
550 | '%s/_xmlhandler.i' % location, | |
551 | ]) | |
552 | ||
553 | ext = Extension('_xrc', | |
3ef86e32 | 554 | swig_sources, |
1fded56b | 555 | |
4c417214 | 556 | include_dirs = includes + CONTRIBS_INC, |
d56cebe7 RD |
557 | define_macros = defines, |
558 | ||
559 | library_dirs = libdirs, | |
3ef86e32 | 560 | libraries = libs + makeLibName('xrc'), |
d56cebe7 RD |
561 | |
562 | extra_compile_args = cflags, | |
563 | extra_link_args = lflags, | |
564 | ) | |
565 | ||
566 | wxpExtensions.append(ext) | |
567 | ||
568 | ||
569 | ||
ebf4302c RD |
570 | #---------------------------------------------------------------------- |
571 | # Define the GIZMOS extension module | |
572 | #---------------------------------------------------------------------- | |
573 | ||
1e4a197e | 574 | if BUILD_GIZMOS: |
ebf4302c RD |
575 | msg('Preparing GIZMOS...') |
576 | location = 'contrib/gizmos' | |
ebf4302c | 577 | |
a32360e0 | 578 | swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR, |
10ef30eb | 579 | USE_SWIG, swig_force, swig_args, swig_deps) |
ebf4302c | 580 | |
d14a1e28 | 581 | ext = Extension('_gizmos', |
d84a9306 | 582 | [ '%s/treelistctrl.cpp' % location ] + swig_sources, |
ebf4302c | 583 | |
4c417214 | 584 | include_dirs = includes + [ location ] + CONTRIBS_INC, |
ebf4302c RD |
585 | define_macros = defines, |
586 | ||
587 | library_dirs = libdirs, | |
3ef86e32 | 588 | libraries = libs + makeLibName('gizmos'), |
ebf4302c RD |
589 | |
590 | extra_compile_args = cflags, | |
591 | extra_link_args = lflags, | |
592 | ) | |
593 | ||
594 | wxpExtensions.append(ext) | |
595 | ||
596 | ||
597 | ||
4a61305d RD |
598 | #---------------------------------------------------------------------- |
599 | # Define the DLLWIDGET extension module | |
600 | #---------------------------------------------------------------------- | |
601 | ||
1e4a197e | 602 | if BUILD_DLLWIDGET: |
4a61305d RD |
603 | msg('Preparing DLLWIDGET...') |
604 | location = 'contrib/dllwidget' | |
605 | swig_files = ['dllwidget_.i'] | |
606 | ||
607 | swig_sources = run_swig(swig_files, location, '', PKGDIR, | |
10ef30eb | 608 | USE_SWIG, swig_force, swig_args, swig_deps) |
4a61305d RD |
609 | |
610 | # copy a contrib project specific py module to the main package dir | |
611 | copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0) | |
99abd512 | 612 | CLEANUP.append(opj(PKGDIR, 'dllwidget.py')) |
4a61305d RD |
613 | |
614 | ext = Extension('dllwidget_c', [ | |
615 | '%s/dllwidget.cpp' % location, | |
616 | ] + swig_sources, | |
617 | ||
4c417214 | 618 | include_dirs = includes + CONTRIBS_INC, |
4a61305d RD |
619 | define_macros = defines, |
620 | ||
621 | library_dirs = libdirs, | |
622 | libraries = libs, | |
623 | ||
624 | extra_compile_args = cflags, | |
625 | extra_link_args = lflags, | |
626 | ) | |
627 | ||
628 | wxpExtensions.append(ext) | |
629 | ||
630 | ||
1e4a197e RD |
631 | |
632 | ||
633 | #---------------------------------------------------------------------- | |
1128a89b | 634 | # Tools, scripts data files, etc. |
1e4a197e | 635 | #---------------------------------------------------------------------- |
8916d007 | 636 | |
2eb31f8b RD |
637 | if NO_SCRIPTS: |
638 | SCRIPTS = None | |
639 | else: | |
1e4a197e RD |
640 | SCRIPTS = [opj('scripts/helpviewer'), |
641 | opj('scripts/img2png'), | |
2eb31f8b RD |
642 | opj('scripts/img2xpm'), |
643 | opj('scripts/img2py'), | |
644 | opj('scripts/xrced'), | |
645 | opj('scripts/pyshell'), | |
646 | opj('scripts/pycrust'), | |
1fded56b RD |
647 | opj('scripts/pywrap'), |
648 | opj('scripts/pywrap'), | |
649 | opj('scripts/pyalacarte'), | |
650 | opj('scripts/pyalamode'), | |
2eb31f8b | 651 | ] |
4a61305d | 652 | |
926bb76c | 653 | |
c2079460 RD |
654 | DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc') |
655 | DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html') | |
1fded56b | 656 | DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html') |
1e4a197e RD |
657 | |
658 | ||
1128a89b RD |
659 | if NO_HEADERS: |
660 | HEADERS = None | |
661 | else: | |
662 | h_files = glob.glob(opj("include/wx/wxPython/*.h")) | |
663 | i_files = glob.glob(opj("src/*.i")) + \ | |
664 | glob.glob(opj("src/_*.py")) + \ | |
665 | glob.glob(opj("src/*.swg")) | |
666 | ||
667 | HEADERS = zip(h_files, ["/include/wx/wxPython"]*len(h_files)) + \ | |
668 | zip(i_files, ["/include/wx/wxPython/i_files"]*len(i_files)) | |
669 | ||
c368d904 RD |
670 | #---------------------------------------------------------------------- |
671 | # Do the Setup/Build/Install/Whatever | |
672 | #---------------------------------------------------------------------- | |
673 | ||
1b62f00d | 674 | if __name__ == "__main__": |
1e4a197e | 675 | if not PREP_ONLY: |
d14a1e28 | 676 | setup(name = 'wxPython', |
1b62f00d RD |
677 | version = VERSION, |
678 | description = DESCRIPTION, | |
679 | long_description = LONG_DESCRIPTION, | |
680 | author = AUTHOR, | |
681 | author_email = AUTHOR_EMAIL, | |
682 | url = URL, | |
851d4ac7 | 683 | download_url = DOWNLOAD_URL, |
e2e02194 | 684 | license = LICENSE, |
851d4ac7 RD |
685 | platforms = PLATFORMS, |
686 | classifiers = filter(None, CLASSIFIERS.split("\n")), | |
687 | keywords = KEYWORDS, | |
d14a1e28 | 688 | |
1fded56b RD |
689 | packages = ['wxPython', |
690 | 'wxPython.lib', | |
691 | 'wxPython.lib.colourchooser', | |
692 | 'wxPython.lib.editor', | |
693 | 'wxPython.lib.mixins', | |
1fded56b | 694 | 'wxPython.tools', |
1fded56b RD |
695 | |
696 | 'wx', | |
1128a89b | 697 | 'wx.build', |
1fded56b RD |
698 | 'wx.lib', |
699 | 'wx.lib.colourchooser', | |
700 | 'wx.lib.editor', | |
701 | 'wx.lib.mixins', | |
702 | 'wx.py', | |
703 | 'wx.tools', | |
704 | 'wx.tools.XRCed', | |
1b62f00d RD |
705 | ], |
706 | ||
707 | ext_package = PKGDIR, | |
708 | ext_modules = wxpExtensions, | |
8916d007 | 709 | |
1128a89b RD |
710 | options = { 'build' : { 'build_base' : BUILD_BASE }, |
711 | }, | |
a541c325 | 712 | |
1128a89b | 713 | scripts = SCRIPTS, |
1e4a197e | 714 | data_files = DATA_FILES, |
1128a89b | 715 | headers = HEADERS, |
8916d007 | 716 | |
1128a89b RD |
717 | cmdclass = { 'install_data': wx_smart_install_data, |
718 | 'install_headers': wx_install_headers, | |
719 | 'clean': wx_extra_clean, | |
720 | }, | |
1b62f00d | 721 | ) |
c368d904 | 722 | |
c368d904 | 723 | |
c368d904 RD |
724 | #---------------------------------------------------------------------- |
725 | #---------------------------------------------------------------------- |