]> git.saurik.com Git - wxWidgets.git/blob - wxPython/setup.py
Comment out a debug printf
[wxWidgets.git] / wxPython / setup.py
1 #!/usr/bin/env python
2 #----------------------------------------------------------------------
3
4 import sys, os, string, glob
5 from distutils.core import setup, Extension
6 from distutils.file_util import copy_file
7 from distutils.dir_util import mkpath
8 from distutils.dep_util import newer
9
10 from my_distutils import run_swig, contrib_copy_tree
11
12 #----------------------------------------------------------------------
13 # flags and values that affect this script
14 #----------------------------------------------------------------------
15
16 VERSION = "2.3.3pre6"
17 DESCRIPTION = "Cross platform GUI toolkit for Python"
18 AUTHOR = "Robin Dunn"
19 AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
20 URL = "http://wxPython.org/"
21 LICENSE = "wxWindows (LGPL derivative)"
22 LONG_DESCRIPTION = """\
23 wxPython is a GUI toolkit for Python that is a wrapper around the
24 wxWindows C++ GUI library. wxPython provides a large variety of
25 window types and controls, all implemented with a native look and
26 feel (and native runtime speed) on the platforms it is supported
27 on.
28 """
29
30
31 BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module
32 BUILD_OGL = 1 # If true, build the contrib/ogl extension module
33 BUILD_STC = 1 # If true, build the contrib/stc extension module
34 BUILD_XRC = 1 # XML based resource system
35 BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library
36 BUILD_DLLWIDGET = 1# Build a module that enables unknown wx widgets
37 # to be loaded from a DLL and to be used from Python.
38
39 # Internet Explorer wrapper (experimental)
40 BUILD_IEWIN = (os.name == 'nt')
41
42 CORE_ONLY = 0 # if true, don't build any of the above
43
44 GL_ONLY = 0 # Only used when making the -gl RPM. See the "b" script
45 # for the ugly details
46
47 USE_SWIG = 0 # Should we actually execute SWIG, or just use the
48 # files already in the distribution?
49
50 UNICODE = 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
51 # will ensure that the right headers are found and the
52 # right libs are linked.
53
54 IN_CVS_TREE = 0 # Set to true if building in a full wxWindows CVS
55 # tree, otherwise will assume all needed files are
56 # available in the wxPython source distribution
57
58 UNDEF_NDEBUG = 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
59 # and distutils will pick this up and use it on the
60 # compile command-line for the extensions. This could
61 # conflict with how wxWindows was built. If NDEBUG is
62 # set then wxWindows' __WXDEBUG__ setting will be turned
63 # off. If wxWindows was actually built with it turned
64 # on then you end up with mismatched class structures,
65 # and wxPython will crash.
66
67 NO_SCRIPTS = 0 # Don't install the tool scripts
68
69
70 WX_CONFIG = "wx-config" # Usually you shouldn't need to touch this,
71 # but you can set it to pass an alternate
72 # version of wx-config or alternate flags,
73 # eg. as required by the .deb in-tree build.
74
75 BUILD_BASE = "build"
76
77 # Some MSW build settings
78
79 FINAL = 0 # Mirrors use of same flag in wx makefiles,
80 # (0 or 1 only) should probably find a way to
81 # autodetect this...
82
83 HYBRID = 1 # If set and not debug or FINAL, then build a
84 # hybrid extension that can be used by the
85 # non-debug version of python, but contains
86 # debugging symbols for wxWindows and wxPython.
87 # wxWindows must have been built with /MD, not /MDd
88 # (using FINAL=hybrid will do it.)
89
90 WXDLLVER = '233' # Version part of wxWindows DLL name
91
92
93 #----------------------------------------------------------------------
94
95 def msg(text):
96 if __name__ == "__main__":
97 print text
98
99
100 def opj(*args):
101 path = apply(os.path.join, args)
102 return os.path.normpath(path)
103
104
105 def libFlag():
106 if FINAL:
107 rv = ''
108 elif HYBRID:
109 rv = 'h'
110 else:
111 rv = 'd'
112 if UNICODE:
113 rv = 'u' + rv
114 return rv
115
116
117 #----------------------------------------------------------------------
118 # Some other globals
119 #----------------------------------------------------------------------
120
121 PKGDIR = 'wxPython'
122 wxpExtensions = []
123
124 force = '--force' in sys.argv or '-f' in sys.argv
125 debug = '--debug' in sys.argv or '-g' in sys.argv
126
127 bcpp_compiling = '-c' in sys.argv and 'my_bcpp' in sys.argv # Bad heuristic
128
129 if bcpp_compiling:
130 msg("Compiling wxPython by Borland C/C++ Compiler")
131 HYBRID=0
132 WXBCPPLIBVER = string.replace(WXDLLVER,"_","")
133 # Version part of BCPP build LIBRARY name
134 WXDLLVER="" # no dll ver path avaible
135
136
137 #----------------------------------------------------------------------
138 # Check for build flags on the command line
139 #----------------------------------------------------------------------
140
141 # Boolean (int) flags
142 for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
143 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
144 'CORE_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE',
145 'UNDEF_NDEBUG', 'NO_SCRIPTS',
146 'FINAL', 'HYBRID', ]:
147 for x in range(len(sys.argv)):
148 if string.find(sys.argv[x], flag) == 0:
149 pos = string.find(sys.argv[x], '=') + 1
150 if pos > 0:
151 vars()[flag] = eval(sys.argv[x][pos:])
152 sys.argv[x] = ''
153
154 # String options
155 for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE']:
156 for x in range(len(sys.argv)):
157 if string.find(sys.argv[x], option) == 0:
158 pos = string.find(sys.argv[x], '=') + 1
159 if pos > 0:
160 vars()[option] = sys.argv[x][pos:]
161 sys.argv[x] = ''
162
163 sys.argv = filter(None, sys.argv)
164
165
166
167 #----------------------------------------------------------------------
168 # sanity checks
169
170 if CORE_ONLY:
171 BUILD_GLCANVAS = 0
172 BUILD_OGL = 0
173 BUILD_STC = 0
174 BUILD_XRC = 0
175 BUILD_GIZMOS = 0
176 BUILD_DLLWIDGET = 0
177 BUILD_IEWIN = 0
178
179
180 if UNICODE and os.name != 'nt':
181 print "UNICODE is currently only supported on Win32"
182 sys.exit()
183
184
185 if UNICODE:
186 BUILD_BASE = BUILD_BASE + '.unicode'
187 VERSION = VERSION + 'u'
188
189
190 #----------------------------------------------------------------------
191 # Setup some platform specific stuff
192 #----------------------------------------------------------------------
193
194 if os.name == 'nt':
195 # Set compile flags and such for MSVC. These values are derived
196 # from the wxWindows makefiles for MSVC, other compilers settings
197 # will probably vary...
198 if os.environ.has_key('WXWIN'):
199 WXDIR = os.environ['WXWIN']
200 else:
201 msg("WARNING: WXWIN not set in environment.")
202 WXDIR = '..' # assumes in CVS tree
203 WXPLAT = '__WXMSW__'
204 GENDIR = 'msw'
205
206 if debug:
207 FINAL = 0
208 HYBRID = 0
209
210 if HYBRID:
211 FINAL = 0
212
213 includes = ['src',
214 opj(WXDIR, 'lib', 'mswdll' + libFlag()),
215 opj(WXDIR, 'include'),
216 ]
217
218 defines = [ ('WIN32', None), # Some of these are no longer
219 ('__WIN32__', None), # necessary. Anybody know which?
220 ('_WINDOWS', None),
221 ('__WINDOWS__', None),
222 ('WINVER', '0x0400'),
223 ('__WIN95__', None),
224 ('STRICT', None),
225
226 (WXPLAT, None),
227 ('WXUSINGDLL', '1'),
228
229 ('SWIG_GLOBAL', None),
230 ('HAVE_CONFIG_H', None),
231 ('WXP_USE_THREAD', '1'),
232 ]
233
234 if bcpp_compiling: # overwrite it
235 defines = [
236 ('_WINDOWS', None),
237 ('WINVER', '0x0400'),
238 ('STRICT', None),
239
240 ('WXUSINGDLL', '1'),
241
242 ('SWIG_GLOBAL', None),
243 ('HAVE_CONFIG_H', None),
244 ('WXP_USE_THREAD', '1'),
245
246 ('WXUSE_DEFINE','1'),
247 ('_RTLDLL',None),
248 ]
249
250
251 if not FINAL or HYBRID:
252 defines.append( ('__WXDEBUG__', None) )
253
254 libdirs = [ opj(WXDIR, 'lib') ]
255 wxdll = 'wxmsw' + WXDLLVER + libFlag()
256 libs = [ wxdll ]
257
258 if bcpp_compiling:
259 libs = [ 'wx'+WXBCPPLIBVER ]
260
261 libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32',
262 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
263 'ctl3d32', 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
264 'advapi32', 'wsock32']
265
266
267 cflags = [ '/Gy',
268 # '/GX-' # workaround for internal compiler error in MSVC on some machines
269 ]
270 lflags = None
271
272
273 if bcpp_compiling: # BCC flags
274 cflags = ['-5', '-VF', ### To support MSVC spurious semicolons in the class scope
275 ### else, all semicolons at the end of all DECLARE_...CALLBACK... macros must be eliminated
276 '-Hc', '-H=' + opj(WXDIR, '\src\msw\wx32.csm'),
277 '@' + opj(WXDIR, '\src\msw\wxwin32.cfg')
278 ]
279 if not FINAL:
280 cflags = cflags + ['/Od', '/v', '/y']
281 lflags = lflags + ['/v', ]
282
283 else: # MSVC flags
284 if FINAL:
285 pass #cflags = cflags + ['/O1']
286 elif HYBRID :
287 pass #cflags = cflags + ['/Ox']
288 else:
289 pass # cflags = cflags + ['/Od', '/Z7']
290 # lflags = ['/DEBUG', ]
291
292
293
294
295 elif os.name == 'posix' and sys.platform[:6] == "darwin":
296 # Flags and such for a Darwin (Max OS X) build of Python
297
298 WXDIR = '..' # assumes IN_CVS_TREE
299 WXPLAT = '__WXMAC__'
300 GENDIR = 'mac'
301
302 includes = ['src']
303 defines = [('SWIG_GLOBAL', None),
304 ('HAVE_CONFIG_H', None),
305 ('WXP_USE_THREAD', '1'),
306 ]
307 libdirs = []
308 libs = []
309
310 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
311 cflags = string.split(cflags)
312 if UNDEF_NDEBUG:
313 cflags.append('-UNDEBUG')
314
315 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
316 lflags = string.split(lflags)
317
318 NO_SCRIPTS = 1
319
320
321 elif os.name == 'posix':
322 # Set flags for Unix type platforms
323
324 WXDIR = '..' # assumes IN_CVS_TREE
325 WXPLAT = '__WXGTK__' # and assumes GTK...
326 GENDIR = 'gtk' # Need to allow for Motif eventually too
327
328 includes = ['src']
329 defines = [('SWIG_GLOBAL', None),
330 ('HAVE_CONFIG_H', None),
331 ('WXP_USE_THREAD', '1'),
332 ]
333 libdirs = []
334 libs = []
335
336 cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1] + ' ' + \
337 os.popen('gtk-config --cflags', 'r').read()[:-1]
338 cflags = string.split(cflags)
339 if UNDEF_NDEBUG:
340 cflags.append('-UNDEBUG')
341
342 lflags = os.popen(WX_CONFIG + ' --libs', 'r').read()[:-1]
343 lflags = string.split(lflags)
344
345
346 else:
347 raise 'Sorry Charlie...'
348
349
350 #----------------------------------------------------------------------
351 # Check if the version file needs updated
352 #----------------------------------------------------------------------
353
354 #if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
355 open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION)
356
357
358
359 #----------------------------------------------------------------------
360 # SWIG defaults
361 #----------------------------------------------------------------------
362
363 swig_force = force
364 swig_args = ['-c++', '-shadow', '-python', '-keyword',
365 '-dnone',
366 #'-dascii',
367 #'-docstring', '-Sbefore',
368 '-I./src', '-D'+WXPLAT,
369 ]
370 if UNICODE:
371 swig_args.append('-DwxUSE_UNICODE')
372
373 swig_deps = ['src/my_typemaps.i']
374
375
376 #----------------------------------------------------------------------
377 # Define the CORE extension module
378 #----------------------------------------------------------------------
379
380 if not GL_ONLY:
381 msg('Preparing CORE...')
382 swig_files = [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
383 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
384 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
385 'printfw.i', 'sizers.i', 'clip_dnd.i',
386 'filesys.i', 'streams.i', 'utils.i', 'fonts.i'
387 ]
388
389 swig_sources = run_swig(swig_files, 'src', GENDIR, PKGDIR,
390 USE_SWIG, swig_force, swig_args, swig_deps)
391
392 copy_file('src/__init__.py', PKGDIR, update=1, verbose=0)
393 copy_file('src/__version__.py', PKGDIR, update=1, verbose=0)
394 copy_file('src/wxc.pyd.manifest', PKGDIR, update=1, verbose=0)
395
396 if IN_CVS_TREE: # update the license files
397 mkpath('licence')
398 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
399 copy_file(opj(WXDIR, 'docs', file), opj('licence',file), update=1, verbose=0)
400
401
402 if os.name == 'nt':
403 rc_file = ['src/wxc.rc']
404 else:
405 rc_file = []
406
407
408 ext = Extension('wxc', ['src/helpers.cpp',
409 'src/libpy.c',
410 ] + rc_file + swig_sources,
411
412 include_dirs = includes,
413 define_macros = defines,
414
415 library_dirs = libdirs,
416 libraries = libs,
417
418 extra_compile_args = cflags,
419 extra_link_args = lflags,
420 )
421 wxpExtensions.append(ext)
422
423
424 # Extension for the grid module
425 swig_sources = run_swig(['grid.i'], 'src', GENDIR, PKGDIR,
426 USE_SWIG, swig_force, swig_args, swig_deps)
427 ext = Extension('gridc', swig_sources,
428 include_dirs = includes,
429 define_macros = defines,
430 library_dirs = libdirs,
431 libraries = libs,
432 extra_compile_args = cflags,
433 extra_link_args = lflags,
434 )
435 wxpExtensions.append(ext)
436
437
438 # Extension for the html modules
439 swig_sources = run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR, PKGDIR,
440 USE_SWIG, swig_force, swig_args, swig_deps)
441 ext = Extension('htmlc', swig_sources,
442 include_dirs = includes,
443 define_macros = defines,
444 library_dirs = libdirs,
445 libraries = libs,
446 extra_compile_args = cflags,
447 extra_link_args = lflags,
448 )
449 wxpExtensions.append(ext)
450
451
452 # Extension for the calendar module
453 swig_sources = run_swig(['calendar.i'], 'src', GENDIR, PKGDIR,
454 USE_SWIG, swig_force, swig_args, swig_deps)
455 ext = Extension('calendarc', swig_sources,
456 include_dirs = includes,
457 define_macros = defines,
458 library_dirs = libdirs,
459 libraries = libs,
460 extra_compile_args = cflags,
461 extra_link_args = lflags,
462 )
463 wxpExtensions.append(ext)
464
465
466 # Extension for the help module
467 swig_sources = run_swig(['help.i'], 'src', GENDIR, PKGDIR,
468 USE_SWIG, swig_force, swig_args, swig_deps)
469 ext = Extension('helpc', swig_sources,
470 include_dirs = includes,
471 define_macros = defines,
472 library_dirs = libdirs,
473 libraries = libs,
474 extra_compile_args = cflags,
475 extra_link_args = lflags,
476 )
477 wxpExtensions.append(ext)
478
479
480 # Extension for the wizard module
481 swig_sources = run_swig(['wizard.i'], 'src', GENDIR, PKGDIR,
482 USE_SWIG, swig_force, swig_args, swig_deps)
483 ext = Extension('wizardc', swig_sources,
484 include_dirs = includes,
485 define_macros = defines,
486 library_dirs = libdirs,
487 libraries = libs,
488 extra_compile_args = cflags,
489 extra_link_args = lflags,
490 )
491 wxpExtensions.append(ext)
492
493
494 #----------------------------------------------------------------------
495 # Define the GLCanvas extension module
496 #----------------------------------------------------------------------
497
498 CTRB_SRC = opj(WXDIR, 'contrib/src')
499 CTRB_INC = opj(WXDIR, 'contrib/include/wx')
500
501 if BUILD_GLCANVAS or GL_ONLY:
502 msg('Preparing GLCANVAS...')
503 location = 'contrib/glcanvas'
504 swig_files = ['glcanvas.i']
505 other_sources = []
506
507 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
508 USE_SWIG, swig_force, swig_args, swig_deps)
509
510 gl_libs = []
511 if os.name == 'posix':
512 gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1]
513 gl_lflags = string.split(gl_config) + lflags
514 gl_libs = libs
515 else:
516 other_sources = [opj(location, 'msw/myglcanvas.cpp')]
517 gl_libs = libs + ['opengl32', 'glu32']
518 gl_lflags = lflags
519
520 ext = Extension('glcanvasc',
521 swig_sources + other_sources,
522
523 include_dirs = includes,
524 define_macros = defines,
525
526 library_dirs = libdirs,
527 libraries = gl_libs,
528
529 extra_compile_args = cflags,
530 extra_link_args = gl_lflags,
531 )
532
533 wxpExtensions.append(ext)
534
535
536 #----------------------------------------------------------------------
537 # Define the OGL extension module
538 #----------------------------------------------------------------------
539
540 if not GL_ONLY and BUILD_OGL:
541 msg('Preparing OGL...')
542 location = 'contrib/ogl'
543 OGLLOC = opj(location, 'contrib/src/ogl')
544 OGLINC = opj(location, 'contrib/include')
545
546 swig_files = ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
547 'oglcanvas.i']
548
549 swig_sources = run_swig(swig_files, location, '', PKGDIR,
550 USE_SWIG, swig_force, swig_args, swig_deps)
551
552 if IN_CVS_TREE:
553 # make sure local copy of contrib files are up to date
554 contrib_copy_tree(opj(CTRB_INC, 'ogl'), opj(OGLINC, 'wx/ogl'))
555 contrib_copy_tree(opj(CTRB_SRC, 'ogl'), OGLLOC)
556
557 ext = Extension('oglc', ['%s/basic.cpp' % OGLLOC,
558 '%s/bmpshape.cpp' % OGLLOC,
559 '%s/composit.cpp' % OGLLOC,
560 '%s/divided.cpp' % OGLLOC,
561 '%s/lines.cpp' % OGLLOC,
562 '%s/misc.cpp' % OGLLOC,
563 '%s/basic2.cpp' % OGLLOC,
564 '%s/canvas.cpp' % OGLLOC,
565 '%s/constrnt.cpp' % OGLLOC,
566 '%s/drawn.cpp' % OGLLOC,
567 '%s/mfutils.cpp' % OGLLOC,
568 '%s/ogldiag.cpp' % OGLLOC,
569 ] + swig_sources,
570
571 include_dirs = [OGLINC] + includes,
572 define_macros = defines,
573
574 library_dirs = libdirs,
575 libraries = libs,
576
577 extra_compile_args = cflags,
578 extra_link_args = lflags,
579 )
580
581 wxpExtensions.append(ext)
582
583
584
585 #----------------------------------------------------------------------
586 # Define the STC extension module
587 #----------------------------------------------------------------------
588
589 if not GL_ONLY and BUILD_STC:
590 msg('Preparing STC...')
591 location = 'contrib/stc'
592 STCLOC = opj(location, 'contrib/src/stc')
593 STCINC = opj(location, 'contrib/include')
594 STC_H = opj(location, 'contrib/include/wx/stc')
595
596 if IN_CVS_TREE:
597 # Check if gen_iface needs to be run for the wxSTC sources
598 if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
599 newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
600 newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
601
602 msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
603 cwd = os.getcwd()
604 os.chdir(opj(CTRB_SRC, 'stc'))
605 import gen_iface
606 gen_iface.main([])
607 os.chdir(cwd)
608
609
610 # make sure local copy of contrib files are up to date
611 contrib_copy_tree(opj(CTRB_INC, 'stc'), opj(STCINC, 'wx/stc'))
612 contrib_copy_tree(opj(CTRB_SRC, 'stc'), STCLOC)
613
614
615
616 swig_files = ['stc_.i']
617 swig_sources = run_swig(swig_files, location, GENDIR, PKGDIR,
618 USE_SWIG, swig_force,
619 swig_args + ['-I'+STC_H, '-I'+location],
620 [opj(STC_H, 'stc.h')] + swig_deps)
621
622 # copy a contrib project specific py module to the main package dir
623 copy_file(opj(location, 'stc.py'), PKGDIR, update=1, verbose=0)
624
625 # add some include dirs to the standard set
626 stc_includes = includes[:]
627 stc_includes.append('%s/scintilla/include' % STCLOC)
628 stc_includes.append('%s/scintilla/src' % STCLOC)
629 stc_includes.append(STCINC)
630
631 # and some macro definitions
632 stc_defines = defines[:]
633 stc_defines.append( ('__WX__', None) )
634 stc_defines.append( ('SCI_LEXER', None) )
635 stc_defines.append( ('LINK_LEXERS', None) )
636
637
638 ext = Extension('stc_c',
639 ['%s/scintilla/src/AutoComplete.cxx' % STCLOC,
640 '%s/scintilla/src/CallTip.cxx' % STCLOC,
641 '%s/scintilla/src/CellBuffer.cxx' % STCLOC,
642 '%s/scintilla/src/ContractionState.cxx' % STCLOC,
643 '%s/scintilla/src/Document.cxx' % STCLOC,
644 '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC,
645 '%s/scintilla/src/Editor.cxx' % STCLOC,
646 '%s/scintilla/src/Indicator.cxx' % STCLOC,
647 '%s/scintilla/src/KeyMap.cxx' % STCLOC,
648 '%s/scintilla/src/KeyWords.cxx' % STCLOC,
649 '%s/scintilla/src/LineMarker.cxx' % STCLOC,
650 '%s/scintilla/src/PropSet.cxx' % STCLOC,
651 '%s/scintilla/src/RESearch.cxx' % STCLOC,
652 '%s/scintilla/src/ScintillaBase.cxx' % STCLOC,
653 '%s/scintilla/src/Style.cxx' % STCLOC,
654 '%s/scintilla/src/StyleContext.cxx' % STCLOC,
655 '%s/scintilla/src/UniConversion.cxx' % STCLOC,
656 '%s/scintilla/src/ViewStyle.cxx' % STCLOC,
657 '%s/scintilla/src/WindowAccessor.cxx' % STCLOC,
658
659 '%s/scintilla/src/LexAda.cxx' % STCLOC,
660 '%s/scintilla/src/LexAVE.cxx' % STCLOC,
661 '%s/scintilla/src/LexBaan.cxx' % STCLOC,
662 '%s/scintilla/src/LexBullant.cxx' % STCLOC,
663 '%s/scintilla/src/LexCPP.cxx' % STCLOC,
664 '%s/scintilla/src/LexConf.cxx' % STCLOC,
665 '%s/scintilla/src/LexCrontab.cxx' % STCLOC,
666 '%s/scintilla/src/LexEiffel.cxx' % STCLOC,
667 '%s/scintilla/src/LexHTML.cxx' % STCLOC,
668 '%s/scintilla/src/LexLisp.cxx' % STCLOC,
669 '%s/scintilla/src/LexLua.cxx' % STCLOC,
670 '%s/scintilla/src/LexMatlab.cxx' % STCLOC,
671 '%s/scintilla/src/LexOthers.cxx' % STCLOC,
672 '%s/scintilla/src/LexPascal.cxx' % STCLOC,
673 '%s/scintilla/src/LexPerl.cxx' % STCLOC,
674 '%s/scintilla/src/LexPython.cxx' % STCLOC,
675 '%s/scintilla/src/LexRuby.cxx' % STCLOC,
676 '%s/scintilla/src/LexSQL.cxx' % STCLOC,
677 '%s/scintilla/src/LexVB.cxx' % STCLOC,
678
679 '%s/PlatWX.cpp' % STCLOC,
680 '%s/ScintillaWX.cpp' % STCLOC,
681 '%s/stc.cpp' % STCLOC,
682 ] + swig_sources,
683
684 include_dirs = stc_includes,
685 define_macros = stc_defines,
686
687 library_dirs = libdirs,
688 libraries = libs,
689
690 extra_compile_args = cflags,
691 extra_link_args = lflags,
692 )
693
694 wxpExtensions.append(ext)
695
696
697
698 #----------------------------------------------------------------------
699 # Define the IEWIN extension module (experimental)
700 #----------------------------------------------------------------------
701
702 if not GL_ONLY and BUILD_IEWIN:
703 msg('Preparing IEWIN...')
704 location = 'contrib/iewin'
705
706 swig_files = ['iewin.i', ]
707
708 swig_sources = run_swig(swig_files, location, '', PKGDIR,
709 USE_SWIG, swig_force, swig_args, swig_deps)
710
711
712 ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
713 '%s/wxactivex.cpp' % location,
714 ] + swig_sources,
715
716 include_dirs = includes,
717 define_macros = defines,
718
719 library_dirs = libdirs,
720 libraries = libs,
721
722 extra_compile_args = cflags,
723 extra_link_args = lflags,
724 )
725
726 wxpExtensions.append(ext)
727
728
729 #----------------------------------------------------------------------
730 # Define the XRC extension module
731 #----------------------------------------------------------------------
732
733 if not GL_ONLY and BUILD_XRC:
734 msg('Preparing XRC...')
735 location = 'contrib/xrc'
736 XMLLOC = opj(location, 'contrib/src/xrc')
737 XMLINC = opj(location, 'contrib/include')
738
739 swig_files = ['xrc.i']
740
741 swig_sources = run_swig(swig_files, location, '', PKGDIR,
742 USE_SWIG, swig_force, swig_args, swig_deps)
743
744 xmlres_includes = includes[:]
745 xmlres_includes.append('%s/expat/xmlparse' % XMLLOC)
746 xmlres_includes.append('%s/expat/xmltok' % XMLLOC)
747 xmlres_includes.append(XMLINC)
748
749
750 # make sure local copy of contrib files are up to date
751 if IN_CVS_TREE:
752 contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc'))
753 contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC)
754
755 ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC,
756 '%s/expat/xmltok/xmlrole.c' % XMLLOC,
757 '%s/expat/xmltok/xmltok.c' % XMLLOC,
758
759 '%s/xh_bmp.cpp' % XMLLOC,
760 '%s/xh_bmpbt.cpp' % XMLLOC,
761 '%s/xh_bttn.cpp' % XMLLOC,
762 '%s/xh_cald.cpp' % XMLLOC,
763 '%s/xh_chckb.cpp' % XMLLOC,
764
765 '%s/xh_chckl.cpp' % XMLLOC,
766 '%s/xh_choic.cpp' % XMLLOC,
767 '%s/xh_combo.cpp' % XMLLOC,
768 '%s/xh_dlg.cpp' % XMLLOC,
769 '%s/xh_frame.cpp' % XMLLOC,
770
771 '%s/xh_gauge.cpp' % XMLLOC,
772 '%s/xh_gdctl.cpp' % XMLLOC,
773 '%s/xh_html.cpp' % XMLLOC,
774 '%s/xh_listb.cpp' % XMLLOC,
775 '%s/xh_listc.cpp' % XMLLOC,
776 '%s/xh_menu.cpp' % XMLLOC,
777
778 '%s/xh_notbk.cpp' % XMLLOC,
779 '%s/xh_panel.cpp' % XMLLOC,
780 '%s/xh_radbt.cpp' % XMLLOC,
781 '%s/xh_radbx.cpp' % XMLLOC,
782 '%s/xh_scrol.cpp' % XMLLOC,
783
784 '%s/xh_sizer.cpp' % XMLLOC,
785 '%s/xh_slidr.cpp' % XMLLOC,
786 '%s/xh_spin.cpp' % XMLLOC,
787 '%s/xh_stbmp.cpp' % XMLLOC,
788 '%s/xh_stbox.cpp' % XMLLOC,
789
790 '%s/xh_stlin.cpp' % XMLLOC,
791 '%s/xh_sttxt.cpp' % XMLLOC,
792 '%s/xh_text.cpp' % XMLLOC,
793 '%s/xh_toolb.cpp' % XMLLOC,
794 '%s/xh_tree.cpp' % XMLLOC,
795
796 '%s/xh_unkwn.cpp' % XMLLOC,
797 '%s/xml.cpp' % XMLLOC,
798 '%s/xmlres.cpp' % XMLLOC,
799 '%s/xmlrsall.cpp' % XMLLOC,
800
801 ] + swig_sources,
802
803 include_dirs = xmlres_includes,
804 define_macros = defines,
805
806 library_dirs = libdirs,
807 libraries = libs,
808
809 extra_compile_args = cflags,
810 extra_link_args = lflags,
811 )
812
813 wxpExtensions.append(ext)
814
815
816
817 #----------------------------------------------------------------------
818 # Define the GIZMOS extension module
819 #----------------------------------------------------------------------
820
821 if not GL_ONLY and BUILD_GIZMOS:
822 msg('Preparing GIZMOS...')
823 location = 'contrib/gizmos'
824 GIZMOLOC = opj(location, 'contrib/src/gizmos')
825 GIZMOINC = opj(location, 'contrib/include')
826
827 swig_files = ['gizmos.i']
828
829 swig_sources = run_swig(swig_files, location, '', PKGDIR,
830 USE_SWIG, swig_force, swig_args, swig_deps)
831
832 gizmos_includes = includes[:]
833 gizmos_includes.append(GIZMOINC)
834
835
836 # make sure local copy of contrib files are up to date
837 if IN_CVS_TREE:
838 contrib_copy_tree(opj(CTRB_INC, 'gizmos'), opj(GIZMOINC, 'wx/gizmos'))
839 contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC)
840
841 ext = Extension('gizmosc', [
842 '%s/dynamicsash.cpp' % GIZMOLOC,
843 '%s/editlbox.cpp' % GIZMOLOC,
844 #'%s/multicell.cpp' % GIZMOLOC,
845 '%s/splittree.cpp' % GIZMOLOC,
846 '%s/ledctrl.cpp' % GIZMOLOC,
847 ] + swig_sources,
848
849 include_dirs = gizmos_includes,
850 define_macros = defines,
851
852 library_dirs = libdirs,
853 libraries = libs,
854
855 extra_compile_args = cflags,
856 extra_link_args = lflags,
857 )
858
859 wxpExtensions.append(ext)
860
861
862
863 #----------------------------------------------------------------------
864 # Define the DLLWIDGET extension module
865 #----------------------------------------------------------------------
866
867 if not GL_ONLY and BUILD_DLLWIDGET:
868 msg('Preparing DLLWIDGET...')
869 location = 'contrib/dllwidget'
870 swig_files = ['dllwidget_.i']
871
872 swig_sources = run_swig(swig_files, location, '', PKGDIR,
873 USE_SWIG, swig_force, swig_args, swig_deps)
874
875 # copy a contrib project specific py module to the main package dir
876 copy_file(opj(location, 'dllwidget.py'), PKGDIR, update=1, verbose=0)
877
878 ext = Extension('dllwidget_c', [
879 '%s/dllwidget.cpp' % location,
880 ] + swig_sources,
881
882 include_dirs = includes,
883 define_macros = defines,
884
885 library_dirs = libdirs,
886 libraries = libs,
887
888 extra_compile_args = cflags,
889 extra_link_args = lflags,
890 )
891
892 wxpExtensions.append(ext)
893
894
895 #----------------------------------------------------------------------
896 # Tools and scripts
897 #----------------------------------------------------------------------
898
899 ## TOOLS = [("wxPython/tools", glob.glob("tools/*.py")),
900 ## ("wxPython/tools/XRCed", glob.glob("tools/XRCed/*.py") +
901 ## glob.glob("tools/XRCed/*.xrc") +
902 ## ["tools/XRCed/CHANGES",
903 ## "tools/XRCed/TODO",
904 ## "tools/XRCed/README"]),
905 ## ]
906
907
908 if NO_SCRIPTS:
909 SCRIPTS = None
910 else:
911 SCRIPTS = [opj('scripts/img2png'),
912 opj('scripts/img2xpm'),
913 opj('scripts/img2py'),
914 opj('scripts/xrced'),
915 opj('scripts/pyshell'),
916 opj('scripts/pycrust'),
917 ]
918
919
920 #----------------------------------------------------------------------
921 # Do the Setup/Build/Install/Whatever
922 #----------------------------------------------------------------------
923
924 if __name__ == "__main__":
925 if not GL_ONLY:
926 setup(name = PKGDIR,
927 version = VERSION,
928 description = DESCRIPTION,
929 long_description = LONG_DESCRIPTION,
930 author = AUTHOR,
931 author_email = AUTHOR_EMAIL,
932 url = URL,
933 license = LICENSE,
934
935 packages = [PKGDIR,
936 PKGDIR+'.lib',
937 PKGDIR+'.lib.editor',
938 PKGDIR+'.lib.mixins',
939 PKGDIR+'.lib.PyCrust',
940 PKGDIR+'.tools',
941 PKGDIR+'.tools.XRCed',
942 ],
943
944 ext_package = PKGDIR,
945 ext_modules = wxpExtensions,
946
947 options = { 'build' : { 'build_base' : BUILD_BASE }},
948
949 ##data_files = TOOLS,
950 scripts = SCRIPTS,
951 )
952
953 else:
954
955 setup(name = "wxPython-gl",
956 version = VERSION,
957 description = "wxGLCanvas class for wxPython",
958 author = AUTHOR,
959 author_email = AUTHOR_EMAIL,
960 url = URL,
961 license = LICENSE,
962
963 py_modules = [ "wxPython.glcanvas" ],
964
965 ext_package = PKGDIR,
966 ext_modules = wxpExtensions,
967
968 )
969
970
971
972
973 #----------------------------------------------------------------------
974 #----------------------------------------------------------------------