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