2 #----------------------------------------------------------------------
4 import sys
, os
, glob
, fnmatch
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 from distutils
.spawn
import spawn
10 from distutils
.command
.install_data
import install_data
12 #----------------------------------------------------------------------
13 # flags and values that affect this script
14 #----------------------------------------------------------------------
16 VER_MAJOR
= 2 # The first three must match wxWindows
19 VER_SUBREL
= 0 # wxPython release num for x.y.z release of wxWindows
20 VER_FLAGS
= "p1" # release flags, such as prerelease num, unicode, etc.
22 DESCRIPTION
= "Cross platform GUI toolkit for Python"
24 AUTHOR_EMAIL
= "Robin Dunn <robin@alldunn.com>"
25 URL
= "http://wxPython.org/"
26 LICENSE
= "wxWindows (LGPL derivative)"
27 LONG_DESCRIPTION
= """\
28 wxPython is a GUI toolkit for Python that is a wrapper around the
29 wxWindows C++ GUI library. wxPython provides a large variety of
30 window types and controls, all implemented with a native look and
31 feel (by using the native widgets) on the platforms it is supported
36 # Config values below this point can be reset on the setup.py command line.
38 BUILD_GLCANVAS
= 1 # If true, build the contrib/glcanvas extension module
39 BUILD_OGL
= 1 # If true, build the contrib/ogl extension module
40 BUILD_STC
= 1 # If true, build the contrib/stc extension module
41 BUILD_XRC
= 1 # XML based resource system
42 BUILD_GIZMOS
= 1 # Build a module for the gizmos contrib library
43 BUILD_DLLWIDGET
= 0# Build a module that enables unknown wx widgets
44 # to be loaded from a DLL and to be used from Python.
46 # Internet Explorer wrapper (experimental)
47 BUILD_IEWIN
= (os
.name
== 'nt')
49 BUILD_CANVAS
= 0 # Build a canvas module using the one in wx/contrib (experimental)
50 BUILD_ART2D
= 0 # Build a canvas module using code from the wxArt2D project (experimental)
53 CORE_ONLY
= 0 # if true, don't build any of the above
55 PREP_ONLY
= 0 # Only run the prepatory steps, not the actual build.
57 USE_SWIG
= 0 # Should we actually execute SWIG, or just use the
58 # files already in the distribution?
60 UNICODE
= 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
61 # will ensure that the right headers are found and the
62 # right libs are linked.
64 IN_CVS_TREE
= 1 # Set to true if building in a full wxWindows CVS
65 # tree, or the new style of a full wxPythonSrc tarball.
66 # wxPython used to be distributed as a separate source
67 # tarball without the wxWindows but with a copy of the
68 # needed contrib code. That's no longer the case and so
69 # this setting is now defaulting to true. Eventually it
70 # should be removed entirly.
72 UNDEF_NDEBUG
= 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
73 # and distutils will pick this up and use it on the
74 # compile command-line for the extensions. This could
75 # conflict with how wxWindows was built. If NDEBUG is
76 # set then wxWindows' __WXDEBUG__ setting will be turned
77 # off. If wxWindows was actually built with it turned
78 # on then you end up with mismatched class structures,
79 # and wxPython will crash.
81 NO_SCRIPTS
= 0 # Don't install the tool scripts
83 WX_CONFIG
= None # Usually you shouldn't need to touch this, but you can set
84 # it to pass an alternate version of wx-config or alternate
85 # flags, eg. as required by the .deb in-tree build. By
86 # default a wx-config command will be assembled based on
87 # version, port, etc. and it will be looked for on the
90 WXPORT
= 'gtk' # On Linux/Unix there are several ports of wxWindows available.
91 # Setting this value lets you select which will be used for
92 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
93 # 'x11'. Curently only gtk and gtk2 works.
95 BUILD_BASE
= "build" # Directory to use for temporary build files.
99 # Some MSW build settings
101 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
102 # (0 or 1 only) should probably find a way to
105 HYBRID
= 1 # If set and not debug or FINAL, then build a
106 # hybrid extension that can be used by the
107 # non-debug version of python, but contains
108 # debugging symbols for wxWindows and wxPython.
109 # wxWindows must have been built with /MD, not /MDd
110 # (using FINAL=hybrid will do it.)
112 WXDLLVER
= '250' # Version part of wxWindows DLL name
115 #----------------------------------------------------------------------
118 if __name__
== "__main__":
123 path
= apply(os
.path
.join
, args
)
124 return os
.path
.normpath(path
)
139 #----------------------------------------------------------------------
141 #----------------------------------------------------------------------
147 force
= '--force' in sys
.argv
or '-f' in sys
.argv
148 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
150 # change the PORT default for wxMac
151 if sys
.platform
[:6] == "darwin":
154 # and do the same for wxMSW, just for consistency
159 #----------------------------------------------------------------------
160 # Check for build flags on the command line
161 #----------------------------------------------------------------------
163 # Boolean (int) flags
164 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
165 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
166 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE',
167 'UNDEF_NDEBUG', 'NO_SCRIPTS',
168 'FINAL', 'HYBRID', ]:
169 for x
in range(len(sys
.argv
)):
170 if sys
.argv
[x
].find(flag
) == 0:
171 pos
= sys
.argv
[x
].find('=') + 1
173 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
177 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']:
178 for x
in range(len(sys
.argv
)):
179 if sys
.argv
[x
].find(option
) == 0:
180 pos
= sys
.argv
[x
].find('=') + 1
182 vars()[option
] = sys
.argv
[x
][pos
:]
185 sys
.argv
= filter(None, sys
.argv
)
188 #----------------------------------------------------------------------
189 # some helper functions
190 #----------------------------------------------------------------------
192 def Verify_WX_CONFIG():
193 """ Called below for the builds that need wx-config,
194 if WX_CONFIG is not set then tries to select the specific
195 wx*-config script based on build options. If not found
196 then it defaults to 'wx-config'.
198 # if WX_CONFIG hasn't been set to an explicit value then construct one.
200 if WX_CONFIG
is None:
201 if debug
: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows...
209 ver2
= "%s.%s" % (VER_MAJOR
, VER_MINOR
)
210 WX_CONFIG
= 'wx%s%s%s-%s-config' % (WXPORT
, uf
, df
, ver2
)
212 searchpath
= os
.environ
["PATH"]
213 for p
in searchpath
.split(':'):
214 fp
= os
.path
.join(p
, WX_CONFIG
)
215 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
217 msg("Found wx-config: " + fp
)
221 msg("WX_CONFIG not specified and %s not found on $PATH "
222 "defaulting to \"wx-config\"" % WX_CONFIG
)
223 WX_CONFIG
= 'wx-config'
227 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
228 """Run SWIG the way I want it done"""
229 if not os
.path
.exists(os
.path
.join(dir, gendir
)):
230 os
.mkdir(os
.path
.join(dir, gendir
))
235 basefile
= os
.path
.splitext(file)[0]
236 i_file
= os
.path
.join(dir, file)
237 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
238 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'.cpp')
240 sources
.append(cpp_file
)
243 for dep
in swig_deps
:
244 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
248 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
249 # we need forward slashes here even on win32
250 cpp_file
= '/'.join(cpp_file
.split('\\'))
251 i_file
= '/'.join(i_file
.split('\\'))
253 cmd
= ['./wxSWIG/wxswig'] + swig_args
+ ['-I'+dir, '-c', '-o', cpp_file
, i_file
]
257 # copy the generated python file to the package directory
258 copy_file(py_file
, package
, update
=not force
, verbose
=0)
264 def contrib_copy_tree(src
, dest
, verbose
=0):
265 """Update local copies of wxWindows contrib files"""
266 from distutils
.dir_util
import mkpath
, copy_tree
268 mkpath(dest
, verbose
=verbose
)
269 copy_tree(src
, dest
, update
=1, verbose
=verbose
)
273 class smart_install_data(install_data
):
275 #need to change self.install_dir to the actual library dir
276 install_cmd
= self
.get_finalized_command('install')
277 self
.install_dir
= getattr(install_cmd
, 'install_lib')
278 return install_data
.run(self
)
281 def build_locale_dir(destdir
, verbose
=1):
282 """Build a locale dir under the wxPython package for MSW"""
283 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
285 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
286 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
287 mkpath(dest
, verbose
=verbose
)
288 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
291 def build_locale_list(srcdir
):
292 # get a list of all files under the srcdir, to be used for install_data
293 def walk_helper(lst
, dirname
, files
):
295 filename
= opj(dirname
, f
)
296 if not os
.path
.isdir(filename
):
297 lst
.append( (dirname
, [filename
]) )
299 os
.path
.walk(srcdir
, walk_helper
, file_list
)
303 def find_data_files(srcdir
, *wildcards
):
304 # get a list of all files under the srcdir matching wildcards,
305 # returned in a format to be used for install_data
307 def walk_helper(arg
, dirname
, files
):
312 filename
= opj(dirname
, f
)
313 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
):
314 names
.append(filename
)
316 lst
.append( (dirname
, names
) )
319 os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
))
324 #----------------------------------------------------------------------
343 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
344 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
347 #----------------------------------------------------------------------
348 # Setup some platform specific stuff
349 #----------------------------------------------------------------------
352 # Set compile flags and such for MSVC. These values are derived
353 # from the wxWindows makefiles for MSVC, other compilers settings
354 # will probably vary...
355 if os
.environ
.has_key('WXWIN'):
356 WXDIR
= os
.environ
['WXWIN']
358 msg("WARNING: WXWIN not set in environment.")
359 WXDIR
= '..' # assumes in CVS tree
364 opj(WXDIR
, 'lib', 'mswdll' + libFlag()),
365 opj(WXDIR
, 'include'),
368 defines
= [ ('WIN32', None),
371 ('__WINDOWS__', None),
372 ('WINVER', '0x0400'),
379 ('SWIG_GLOBAL', None),
380 ('HAVE_CONFIG_H', None),
381 ('WXP_USE_THREAD', '1'),
385 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
388 if not FINAL
or HYBRID
:
389 defines
.append( ('__WXDEBUG__', None) )
391 libdirs
= [ opj(WXDIR
, 'lib') ]
392 wxdll
= 'wxmsw' + WXDLLVER
+ libFlag()
395 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
396 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
397 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
398 'advapi32', 'wsock32']
402 # '/GX-' # workaround for internal compiler error in MSVC on some machines
406 # Other MSVC flags...
407 # Too bad I don't remember why I was playing with these, can they be removed?
409 pass #cflags = cflags + ['/O1']
411 pass #cflags = cflags + ['/Ox']
413 pass # cflags = cflags + ['/Od', '/Z7']
414 # lflags = ['/DEBUG', ]
418 #----------------------------------------------------------------------
420 elif os
.name
== 'posix' and sys
.platform
[:6] == "darwin":
421 # Flags and such for a Darwin (Max OS X) build of Python
422 WXDIR
= '..' # assumes IN_CVS_TREE
427 defines
= [('SWIG_GLOBAL', None),
428 ('HAVE_CONFIG_H', None),
429 ('WXP_USE_THREAD', '1'),
432 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
438 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
439 cflags
= cflags
.split()
444 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
445 lflags
= lflags
.split()
450 #----------------------------------------------------------------------
452 elif os
.name
== 'posix':
453 # Set flags for other Unix type platforms
454 WXDIR
= '..' # assumes IN_CVS_TREE
459 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
460 elif WXPORT
== 'gtk2':
462 GENDIR
= 'gtk' # no code differences so use the same generated sources
463 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
464 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
465 elif WXPORT
== 'x11':
468 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
470 raise SystemExit, "Unknown WXPORT value: " + WXPORT
473 defines
= [('SWIG_GLOBAL', None),
474 ('HAVE_CONFIG_H', None),
475 ('WXP_USE_THREAD', '1'),
478 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
485 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg
487 cflags
= cflags
.split()
492 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
493 lflags
= lflags
.split()
495 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
496 # wx-config doesn't output that for some reason. For now, just
497 # add it unconditionally but we should really check if the lib is
498 # really found there or wx-config should be fixed.
499 libdirs
.append("/usr/X11R6/lib")
502 #----------------------------------------------------------------------
504 raise 'Sorry Charlie, platform not supported...'
507 #----------------------------------------------------------------------
508 # post platform setup checks and tweaks, create the full version string
509 #----------------------------------------------------------------------
512 BUILD_BASE
= BUILD_BASE
+ '.unicode'
516 VERSION
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
,
517 VER_SUBREL
, VER_FLAGS
)
519 #----------------------------------------------------------------------
520 # Update the version file
521 #----------------------------------------------------------------------
523 # Unconditionally updated since the version string can change based
524 # on the UNICODE flag
525 open('src/__version__.py', 'w').write("""\
526 # This file was generated by setup.py...
528 wxVERSION_STRING = '%(VERSION)s'
529 wxMAJOR_VERSION = %(VER_MAJOR)s
530 wxMINOR_VERSION = %(VER_MINOR)s
531 wxRELEASE_VERSION = %(VER_RELEASE)s
532 wxSUBREL_VERSION = %(VER_SUBREL)s
534 wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION,
535 wxSUBREL_VERSION, '%(VER_FLAGS)s')
537 wxRELEASE_NUMBER = wxRELEASE_VERSION # for compatibility
543 #----------------------------------------------------------------------
545 #----------------------------------------------------------------------
548 swig_args
= ['-c++', '-shadow', '-python', '-keyword',
551 #'-docstring', '-Sbefore',
552 '-I./src', '-D'+WXPLAT
,
555 swig_args
.append('-DwxUSE_UNICODE')
557 swig_deps
= ['src/my_typemaps.i']
560 #----------------------------------------------------------------------
561 # Define the CORE extension module
562 #----------------------------------------------------------------------
564 msg('Preparing CORE...')
565 swig_files
= [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
566 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
567 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
568 'printfw.i', 'sizers.i', 'clip_dnd.i',
569 'filesys.i', 'streams.i', 'utils.i', 'fonts.i'
572 swig_sources
= run_swig(swig_files
, 'src', GENDIR
, PKGDIR
,
573 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
575 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
576 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0)
579 if IN_CVS_TREE
: # update the license files
581 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
582 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
586 build_locale_dir(opj(PKGDIR
, 'locale'))
587 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
591 rc_file
= ['src/wxc.rc']
596 ext
= Extension('wxc', ['src/helpers.cpp',
599 ] + rc_file
+ swig_sources
,
601 include_dirs
= includes
,
602 define_macros
= defines
,
604 library_dirs
= libdirs
,
607 extra_compile_args
= cflags
,
608 extra_link_args
= lflags
,
610 wxpExtensions
.append(ext
)
613 # Extension for the grid module
614 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
615 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
616 ext
= Extension('gridc', swig_sources
,
617 include_dirs
= includes
,
618 define_macros
= defines
,
619 library_dirs
= libdirs
,
621 extra_compile_args
= cflags
,
622 extra_link_args
= lflags
,
624 wxpExtensions
.append(ext
)
627 # Extension for the html modules
628 swig_sources
= run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR
, PKGDIR
,
629 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
630 ext
= Extension('htmlc', swig_sources
,
631 include_dirs
= includes
,
632 define_macros
= defines
,
633 library_dirs
= libdirs
,
635 extra_compile_args
= cflags
,
636 extra_link_args
= lflags
,
638 wxpExtensions
.append(ext
)
641 # Extension for the calendar module
642 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
643 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
644 ext
= Extension('calendarc', swig_sources
,
645 include_dirs
= includes
,
646 define_macros
= defines
,
647 library_dirs
= libdirs
,
649 extra_compile_args
= cflags
,
650 extra_link_args
= lflags
,
652 wxpExtensions
.append(ext
)
655 # Extension for the help module
656 swig_sources
= run_swig(['help.i'], 'src', GENDIR
, PKGDIR
,
657 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
658 ext
= Extension('helpc', swig_sources
,
659 include_dirs
= includes
,
660 define_macros
= defines
,
661 library_dirs
= libdirs
,
663 extra_compile_args
= cflags
,
664 extra_link_args
= lflags
,
666 wxpExtensions
.append(ext
)
669 # Extension for the wizard module
670 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
671 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
672 ext
= Extension('wizardc', swig_sources
,
673 include_dirs
= includes
,
674 define_macros
= defines
,
675 library_dirs
= libdirs
,
677 extra_compile_args
= cflags
,
678 extra_link_args
= lflags
,
680 wxpExtensions
.append(ext
)
683 #----------------------------------------------------------------------
684 # Define the GLCanvas extension module
685 #----------------------------------------------------------------------
687 CTRB_SRC
= opj(WXDIR
, 'contrib/src')
688 CTRB_INC
= opj(WXDIR
, 'contrib/include/wx')
691 msg('Preparing GLCANVAS...')
692 location
= 'contrib/glcanvas'
693 swig_files
= ['glcanvas.i']
696 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
697 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
700 if os
.name
== 'posix':
701 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
702 gl_lflags
= gl_config
.split() + lflags
705 other_sources
= [opj(location
, 'msw/myglcanvas.cpp')]
706 gl_libs
= libs
+ ['opengl32', 'glu32']
709 ext
= Extension('glcanvasc',
710 swig_sources
+ other_sources
,
712 include_dirs
= includes
,
713 define_macros
= defines
,
715 library_dirs
= libdirs
,
718 extra_compile_args
= cflags
,
719 extra_link_args
= gl_lflags
,
722 wxpExtensions
.append(ext
)
725 #----------------------------------------------------------------------
726 # Define the OGL extension module
727 #----------------------------------------------------------------------
730 msg('Preparing OGL...')
731 location
= 'contrib/ogl'
732 OGLLOC
= opj(location
, 'contrib/src/ogl')
733 OGLINC
= opj(location
, 'contrib/include')
735 swig_files
= ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
738 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
739 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
742 # make sure local copy of contrib files are up to date
743 contrib_copy_tree(opj(CTRB_INC
, 'ogl'), opj(OGLINC
, 'wx/ogl'))
744 contrib_copy_tree(opj(CTRB_SRC
, 'ogl'), OGLLOC
)
746 ext
= Extension('oglc', ['%s/basic.cpp' % OGLLOC
,
747 '%s/bmpshape.cpp' % OGLLOC
,
748 '%s/composit.cpp' % OGLLOC
,
749 '%s/divided.cpp' % OGLLOC
,
750 '%s/lines.cpp' % OGLLOC
,
751 '%s/oglmisc.cpp' % OGLLOC
,
752 '%s/basic2.cpp' % OGLLOC
,
753 '%s/canvas.cpp' % OGLLOC
,
754 '%s/constrnt.cpp' % OGLLOC
,
755 '%s/drawn.cpp' % OGLLOC
,
756 '%s/mfutils.cpp' % OGLLOC
,
757 '%s/ogldiag.cpp' % OGLLOC
,
760 include_dirs
= [OGLINC
] + includes
,
761 define_macros
= defines
+ [('wxUSE_DEPRECATED', '0')],
763 library_dirs
= libdirs
,
766 extra_compile_args
= cflags
,
767 extra_link_args
= lflags
,
770 wxpExtensions
.append(ext
)
774 #----------------------------------------------------------------------
775 # Define the STC extension module
776 #----------------------------------------------------------------------
779 msg('Preparing STC...')
780 location
= 'contrib/stc'
781 STCLOC
= opj(location
, 'contrib/src/stc')
782 STCINC
= opj(location
, 'contrib/include')
783 STC_H
= opj(location
, 'contrib/include/wx/stc')
786 # Check if gen_iface needs to be run for the wxSTC sources
787 if (newer(opj(CTRB_SRC
, 'stc/stc.h.in'), opj(CTRB_INC
, 'stc/stc.h' )) or
788 newer(opj(CTRB_SRC
, 'stc/stc.cpp.in'), opj(CTRB_SRC
, 'stc/stc.cpp')) or
789 newer(opj(CTRB_SRC
, 'stc/gen_iface.py'), opj(CTRB_SRC
, 'stc/stc.cpp'))):
791 msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
793 os
.chdir(opj(CTRB_SRC
, 'stc'))
794 sys
.path
.insert(0, os
.curdir
)
800 # make sure local copy of contrib files are up to date
801 contrib_copy_tree(opj(CTRB_INC
, 'stc'), opj(STCINC
, 'wx/stc'))
802 contrib_copy_tree(opj(CTRB_SRC
, 'stc'), STCLOC
)
806 swig_files
= ['stc_.i']
807 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
808 USE_SWIG
, swig_force
,
809 swig_args
+ ['-I'+STC_H
, '-I'+location
],
810 [opj(STC_H
, 'stc.h')] + swig_deps
)
812 # copy a contrib project specific py module to the main package dir
813 copy_file(opj(location
, 'stc.py'), PKGDIR
, update
=1, verbose
=0)
815 # add some include dirs to the standard set
816 stc_includes
= includes
[:]
817 stc_includes
.append('%s/scintilla/include' % STCLOC
)
818 stc_includes
.append('%s/scintilla/src' % STCLOC
)
819 stc_includes
.append(STCINC
)
821 # and some macro definitions
822 stc_defines
= defines
[:]
823 stc_defines
.append( ('__WX__', None) )
824 stc_defines
.append( ('SCI_LEXER', None) )
825 stc_defines
.append( ('LINK_LEXERS', None) )
828 ext
= Extension('stc_c',
829 ['%s/PlatWX.cpp' % STCLOC
,
830 '%s/ScintillaWX.cpp' % STCLOC
,
831 '%s/stc.cpp' % STCLOC
,
833 '%s/scintilla/src/AutoComplete.cxx' % STCLOC
,
834 '%s/scintilla/src/CallTip.cxx' % STCLOC
,
835 '%s/scintilla/src/CellBuffer.cxx' % STCLOC
,
836 '%s/scintilla/src/ContractionState.cxx' % STCLOC
,
837 '%s/scintilla/src/Document.cxx' % STCLOC
,
838 '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC
,
839 '%s/scintilla/src/Editor.cxx' % STCLOC
,
840 '%s/scintilla/src/Indicator.cxx' % STCLOC
,
841 '%s/scintilla/src/KeyMap.cxx' % STCLOC
,
842 '%s/scintilla/src/KeyWords.cxx' % STCLOC
,
843 '%s/scintilla/src/LineMarker.cxx' % STCLOC
,
844 '%s/scintilla/src/PropSet.cxx' % STCLOC
,
845 '%s/scintilla/src/RESearch.cxx' % STCLOC
,
846 '%s/scintilla/src/ScintillaBase.cxx' % STCLOC
,
847 '%s/scintilla/src/Style.cxx' % STCLOC
,
848 '%s/scintilla/src/StyleContext.cxx' % STCLOC
,
849 '%s/scintilla/src/UniConversion.cxx' % STCLOC
,
850 '%s/scintilla/src/ViewStyle.cxx' % STCLOC
,
851 '%s/scintilla/src/WindowAccessor.cxx' % STCLOC
,
852 '%s/scintilla/src/XPM.cxx' % STCLOC
,
854 + glob
.glob('%s/scintilla/src/Lex*.cxx' % STCLOC
)
857 include_dirs
= stc_includes
,
858 define_macros
= stc_defines
,
860 library_dirs
= libdirs
,
863 extra_compile_args
= cflags
,
864 extra_link_args
= lflags
,
867 wxpExtensions
.append(ext
)
871 #----------------------------------------------------------------------
872 # Define the IEWIN extension module (experimental)
873 #----------------------------------------------------------------------
876 msg('Preparing IEWIN...')
877 location
= 'contrib/iewin'
879 swig_files
= ['iewin.i', ]
881 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
882 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
885 ext
= Extension('iewinc', ['%s/IEHtmlWin.cpp' % location
,
886 '%s/wxactivex.cpp' % location
,
889 include_dirs
= includes
,
890 define_macros
= defines
,
892 library_dirs
= libdirs
,
895 extra_compile_args
= cflags
,
896 extra_link_args
= lflags
,
899 wxpExtensions
.append(ext
)
902 #----------------------------------------------------------------------
903 # Define the XRC extension module
904 #----------------------------------------------------------------------
907 msg('Preparing XRC...')
908 location
= 'contrib/xrc'
909 XMLLOC
= opj(location
, 'contrib/src/xrc')
910 XMLINC
= opj(location
, 'contrib/include')
912 swig_files
= ['xrc.i']
914 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
915 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
917 xmlres_includes
= includes
[:]
918 xmlres_includes
.append('%s/expat/xmlparse' % XMLLOC
)
919 xmlres_includes
.append('%s/expat/xmltok' % XMLLOC
)
920 xmlres_includes
.append(XMLINC
)
923 # make sure local copy of contrib files are up to date
925 contrib_copy_tree(opj(CTRB_INC
, 'xrc'), opj(XMLINC
, 'wx/xrc'))
926 contrib_copy_tree(opj(CTRB_SRC
, 'xrc'), XMLLOC
)
928 ext
= Extension('xrcc',
929 ['%s/expat/xmlparse/xmlparse.c' % XMLLOC
,
930 '%s/expat/xmltok/xmlrole.c' % XMLLOC
,
931 '%s/expat/xmltok/xmltok.c' % XMLLOC
,
933 ] + glob
.glob('%s/xh_*.cpp' % XMLLOC
) +
935 [ '%s/xml.cpp' % XMLLOC
,
936 '%s/xmlres.cpp' % XMLLOC
,
937 '%s/xmlrsall.cpp' % XMLLOC
,
940 include_dirs
= xmlres_includes
,
941 define_macros
= defines
,
943 library_dirs
= libdirs
,
946 extra_compile_args
= cflags
,
947 extra_link_args
= lflags
,
950 wxpExtensions
.append(ext
)
954 #----------------------------------------------------------------------
955 # Define the GIZMOS extension module
956 #----------------------------------------------------------------------
959 msg('Preparing GIZMOS...')
960 location
= 'contrib/gizmos'
961 GIZMOLOC
= opj(location
, 'contrib/src/gizmos')
962 GIZMOINC
= opj(location
, 'contrib/include')
964 swig_files
= ['gizmos.i']
966 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
967 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
969 gizmos_includes
= includes
[:]
970 gizmos_includes
.append(GIZMOINC
)
973 # make sure local copy of contrib files are up to date
975 contrib_copy_tree(opj(CTRB_INC
, 'gizmos'), opj(GIZMOINC
, 'wx/gizmos'))
976 contrib_copy_tree(opj(CTRB_SRC
, 'gizmos'), GIZMOLOC
)
978 ext
= Extension('gizmosc', [
979 '%s/dynamicsash.cpp' % GIZMOLOC
,
980 '%s/editlbox.cpp' % GIZMOLOC
,
981 '%s/splittree.cpp' % GIZMOLOC
,
982 '%s/ledctrl.cpp' % GIZMOLOC
,
983 #'%s/multicell.cpp' % GIZMOLOC,
985 '%s/treelistctrl.cpp' % location
,
989 include_dirs
= gizmos_includes
,
990 define_macros
= defines
,
992 library_dirs
= libdirs
,
995 extra_compile_args
= cflags
,
996 extra_link_args
= lflags
,
999 wxpExtensions
.append(ext
)
1003 #----------------------------------------------------------------------
1004 # Define the DLLWIDGET extension module
1005 #----------------------------------------------------------------------
1008 msg('Preparing DLLWIDGET...')
1009 location
= 'contrib/dllwidget'
1010 swig_files
= ['dllwidget_.i']
1012 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1013 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1015 # copy a contrib project specific py module to the main package dir
1016 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
1018 ext
= Extension('dllwidget_c', [
1019 '%s/dllwidget.cpp' % location
,
1022 include_dirs
= includes
,
1023 define_macros
= defines
,
1025 library_dirs
= libdirs
,
1028 extra_compile_args
= cflags
,
1029 extra_link_args
= lflags
,
1032 wxpExtensions
.append(ext
)
1035 #----------------------------------------------------------------------
1036 # Define the CANVAS extension module
1037 #----------------------------------------------------------------------
1040 msg('Preparing CANVAS...')
1041 location
= 'contrib/canvas'
1042 CANVASLOC
= opj(location
, 'contrib/src/canvas')
1043 CANVASINC
= opj(location
, 'contrib/include')
1045 swig_files
= ['canvas.i']
1047 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1048 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1051 # make sure local copy of contrib files are up to date
1052 contrib_copy_tree(opj(CTRB_INC
, 'canvas'), opj(CANVASINC
, 'wx/canvas'))
1053 contrib_copy_tree(opj(CTRB_SRC
, 'canvas'), CANVASLOC
)
1055 ext
= Extension('canvasc', ['%s/bbox.cpp' % CANVASLOC
,
1056 '%s/liner.cpp' % CANVASLOC
,
1057 '%s/polygon.cpp' % CANVASLOC
,
1058 '%s/canvas.cpp' % CANVASLOC
,
1061 include_dirs
= [CANVASINC
] + includes
,
1062 define_macros
= defines
,
1064 library_dirs
= libdirs
,
1067 extra_compile_args
= cflags
,
1068 extra_link_args
= lflags
,
1071 wxpExtensions
.append(ext
)
1074 #----------------------------------------------------------------------
1075 # Define the ART2D extension module
1076 #----------------------------------------------------------------------
1079 msg('Preparing ART2D...')
1080 location
= 'contrib/art2d'
1081 ART2DLOC
= opj(location
, 'modules/canvas/src')
1082 ART2DINC
= opj(location
, 'modules/canvas/include')
1083 EXPATLOC
= opj(location
, 'modules/expat')
1084 EXPATINC
= opj(location
, 'modules/expat/include')
1086 swig_files
= ['art2d.i',
1092 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1093 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1096 # Don't copy data in this case as the code snapshots are
1100 ext
= Extension('art2dc', [ opj(ART2DLOC
, 'afmatrix.cpp'),
1101 opj(ART2DLOC
, 'bbox.cpp'),
1102 opj(ART2DLOC
, 'cancom.cpp'),
1103 opj(ART2DLOC
, 'candoc.cpp'),
1104 opj(ART2DLOC
, 'canglob.cpp'),
1105 opj(ART2DLOC
, 'canobj3d.cpp'),
1106 opj(ART2DLOC
, 'canobj.cpp'),
1107 opj(ART2DLOC
, 'canprim.cpp'),
1108 opj(ART2DLOC
, 'canprop.cpp'),
1109 opj(ART2DLOC
, 'canvas.cpp'),
1110 opj(ART2DLOC
, 'docviewref.cpp'),
1111 opj(ART2DLOC
, 'drawer.cpp'),
1112 opj(ART2DLOC
, 'eval.cpp'),
1113 opj(ART2DLOC
, 'graph.cpp'),
1114 opj(ART2DLOC
, 'layerinf.cpp'),
1115 opj(ART2DLOC
, 'liner.cpp'),
1116 opj(ART2DLOC
, 'meta.cpp'),
1117 opj(ART2DLOC
, 'objlist.cpp'),
1118 opj(ART2DLOC
, 'polygon.cpp'),
1119 opj(ART2DLOC
, 'recur.cpp'),
1120 opj(ART2DLOC
, 'rendimg.cpp'),
1121 opj(ART2DLOC
, 'tools.cpp'),
1122 opj(ART2DLOC
, 'vpath.cpp'),
1123 opj(ART2DLOC
, 'xmlpars.cpp'),
1125 opj(EXPATLOC
, 'xmlparse/xmlparse.c'),
1126 opj(EXPATLOC
, 'xmltok/xmlrole.c'),
1127 opj(EXPATLOC
, 'xmltok/xmltok.c'),
1131 include_dirs
= [ ART2DINC
,
1133 opj(EXPATLOC
, 'xmltok'),
1134 opj(EXPATLOC
, 'xmlparse'),
1136 define_macros
= defines
,
1138 library_dirs
= libdirs
,
1141 extra_compile_args
= cflags
,
1142 extra_link_args
= lflags
,
1145 wxpExtensions
.append(ext
)
1148 #----------------------------------------------------------------------
1150 #----------------------------------------------------------------------
1155 SCRIPTS
= [opj('scripts/helpviewer'),
1156 opj('scripts/img2png'),
1157 opj('scripts/img2xpm'),
1158 opj('scripts/img2py'),
1159 opj('scripts/xrced'),
1160 opj('scripts/pyshell'),
1161 opj('scripts/pycrust'),
1162 opj('scripts/pywrap'),
1163 opj('scripts/pywrap'),
1164 opj('scripts/pyalacarte'),
1165 opj('scripts/pyalamode'),
1169 DATA_FILES
+= find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc')
1170 DATA_FILES
+= find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html')
1171 DATA_FILES
+= find_data_files('wx', '*.txt', '*.css', '*.html')
1174 #----------------------------------------------------------------------
1175 # Do the Setup/Build/Install/Whatever
1176 #----------------------------------------------------------------------
1178 if __name__
== "__main__":
1180 setup(name
= PKGDIR
,
1182 description
= DESCRIPTION
,
1183 long_description
= LONG_DESCRIPTION
,
1185 author_email
= AUTHOR_EMAIL
,
1189 packages
= ['wxPython',
1191 'wxPython.lib.colourchooser',
1192 'wxPython.lib.editor',
1193 'wxPython.lib.mixins',
1194 'wxPython.lib.PyCrust',
1198 'wxPython.tools.XRCed',
1202 'wx.lib.colourchooser',
1210 ext_package
= PKGDIR
,
1211 ext_modules
= wxpExtensions
,
1213 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1217 cmdclass
= { 'install_data': smart_install_data}
,
1218 data_files
= DATA_FILES
,
1223 #----------------------------------------------------------------------
1224 #----------------------------------------------------------------------