2 #----------------------------------------------------------------------
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 #----------------------------------------------------------------------
17 DESCRIPTION
= "Cross platform GUI toolkit for Python"
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 (by using the native widgets) on the platforms it is supported
31 # Config values below this point can be reset on the setup.py command line.
33 BUILD_GLCANVAS
= 1 # If true, build the contrib/glcanvas extension module
34 BUILD_OGL
= 1 # If true, build the contrib/ogl extension module
35 BUILD_STC
= 1 # If true, build the contrib/stc extension module
36 BUILD_XRC
= 1 # XML based resource system
37 BUILD_GIZMOS
= 1 # Build a module for the gizmos contrib library
38 BUILD_DLLWIDGET
= 0# Build a module that enables unknown wx widgets
39 # to be loaded from a DLL and to be used from Python.
41 # Internet Explorer wrapper (experimental)
42 BUILD_IEWIN
= (os
.name
== 'nt')
44 BUILD_CANVAS
= 0 # Build a canvas module using the one in wx/contrib (experimental)
45 BUILD_ART2D
= 0 # Build a canvas module using code from the wxArt2D project (experimental)
48 CORE_ONLY
= 0 # if true, don't build any of the above
50 PREP_ONLY
= 0 # Only run the prepatory steps, not the actual build.
52 USE_SWIG
= 0 # Should we actually execute SWIG, or just use the
53 # files already in the distribution?
55 UNICODE
= 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
56 # will ensure that the right headers are found and the
57 # right libs are linked.
59 IN_CVS_TREE
= 1 # Set to true if building in a full wxWindows CVS
60 # tree, or the new style of a full wxPythonSrc tarball.
61 # wxPython used to be distributed as a separate source
62 # tarball without the wxWindows but with a copy of the
63 # needed contrib code. That's no longer the case and so
64 # this setting is now defaulting to true. Eventually it
65 # should be removed entirly.
67 UNDEF_NDEBUG
= 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
68 # and distutils will pick this up and use it on the
69 # compile command-line for the extensions. This could
70 # conflict with how wxWindows was built. If NDEBUG is
71 # set then wxWindows' __WXDEBUG__ setting will be turned
72 # off. If wxWindows was actually built with it turned
73 # on then you end up with mismatched class structures,
74 # and wxPython will crash.
76 NO_SCRIPTS
= 0 # Don't install the tool scripts
78 WX_CONFIG
= None # Usually you shouldn't need to touch this, but you can set
79 # it to pass an alternate version of wx-config or alternate
80 # flags, eg. as required by the .deb in-tree build. By
81 # default a wx-config command will be assembled based on
82 # version, port, etc. and it will be looked for on the
85 WXPORT
= 'gtk' # On Linux/Unix there are several ports of wxWindows available.
86 # Setting this value lets you select which will be used for
87 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
88 # 'x11'. Curently only gtk and gtk2 works.
90 BUILD_BASE
= "build" # Directory to use for temporary build files.
94 # Some MSW build settings
96 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
97 # (0 or 1 only) should probably find a way to
100 HYBRID
= 1 # If set and not debug or FINAL, then build a
101 # hybrid extension that can be used by the
102 # non-debug version of python, but contains
103 # debugging symbols for wxWindows and wxPython.
104 # wxWindows must have been built with /MD, not /MDd
105 # (using FINAL=hybrid will do it.)
107 WXDLLVER
= '250' # Version part of wxWindows DLL name
110 #----------------------------------------------------------------------
113 if __name__
== "__main__":
118 path
= apply(os
.path
.join
, args
)
119 return os
.path
.normpath(path
)
134 #----------------------------------------------------------------------
136 #----------------------------------------------------------------------
142 force
= '--force' in sys
.argv
or '-f' in sys
.argv
143 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
145 # change the PORT default for wxMac
146 if sys
.platform
[:6] == "darwin":
149 # and do the same for wxMSW, just for consistency
154 #----------------------------------------------------------------------
155 # Check for build flags on the command line
156 #----------------------------------------------------------------------
158 # Boolean (int) flags
159 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
160 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
161 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE',
162 'UNDEF_NDEBUG', 'NO_SCRIPTS',
163 'FINAL', 'HYBRID', ]:
164 for x
in range(len(sys
.argv
)):
165 if sys
.argv
[x
].find(flag
) == 0:
166 pos
= sys
.argv
[x
].find('=') + 1
168 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
172 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']:
173 for x
in range(len(sys
.argv
)):
174 if sys
.argv
[x
].find(option
) == 0:
175 pos
= sys
.argv
[x
].find('=') + 1
177 vars()[option
] = sys
.argv
[x
][pos
:]
180 sys
.argv
= filter(None, sys
.argv
)
183 #----------------------------------------------------------------------
184 # some helper functions
185 #----------------------------------------------------------------------
187 def Verify_WX_CONFIG():
188 """ Called below for the builds that need wx-config,
189 if WX_CONFIG is not set then tries to select the specific
190 wx*-config script based on build options. If not found
191 then it defaults to 'wx-config'.
193 # if WX_CONFIG hasn't been set to an explicit value then construct one.
195 if WX_CONFIG
is None:
196 if debug
: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows...
205 WX_CONFIG
= 'wx%s%s%s-%s-config' % (WXPORT
, uf
, df
, ver2
)
207 searchpath
= os
.environ
["PATH"]
208 for p
in searchpath
.split(':'):
209 fp
= os
.path
.join(p
, WX_CONFIG
)
210 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
212 msg("Found wx-config: " + fp
)
216 msg("WX_CONFIG not specified and %s not found on $PATH "
217 "defaulting to \"wx-config\"" % WX_CONFIG
)
218 WX_CONFIG
= 'wx-config'
222 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
223 """Run SWIG the way I want it done"""
224 if not os
.path
.exists(os
.path
.join(dir, gendir
)):
225 os
.mkdir(os
.path
.join(dir, gendir
))
230 basefile
= os
.path
.splitext(file)[0]
231 i_file
= os
.path
.join(dir, file)
232 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
233 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'.cpp')
235 sources
.append(cpp_file
)
238 for dep
in swig_deps
:
239 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
243 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
244 # we need forward slashes here even on win32
245 cpp_file
= '/'.join(cpp_file
.split('\\'))
246 i_file
= '/'.join(i_file
.split('\\'))
248 cmd
= ['./wxSWIG/wxswig'] + swig_args
+ ['-I'+dir, '-c', '-o', cpp_file
, i_file
]
252 # copy the generated python file to the package directory
253 copy_file(py_file
, package
, update
=not force
, verbose
=0)
259 def contrib_copy_tree(src
, dest
, verbose
=0):
260 """Update local copies of wxWindows contrib files"""
261 from distutils
.dir_util
import mkpath
, copy_tree
263 mkpath(dest
, verbose
=verbose
)
264 copy_tree(src
, dest
, update
=1, verbose
=verbose
)
268 class smart_install_data(install_data
):
270 #need to change self.install_dir to the actual library dir
271 install_cmd
= self
.get_finalized_command('install')
272 self
.install_dir
= getattr(install_cmd
, 'install_lib')
273 return install_data
.run(self
)
276 def build_locale_dir(destdir
, verbose
=1):
277 """Build a locale dir under the wxPython package for MSW"""
278 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
280 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
281 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
282 mkpath(dest
, verbose
=verbose
)
283 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
286 def build_locale_list(srcdir
):
287 # get a list of all files under the srcdir, to be used for install_data
288 def walk_helper(lst
, dirname
, files
):
290 filename
= opj(dirname
, f
)
291 if not os
.path
.isdir(filename
):
292 lst
.append( (dirname
, [filename
]) )
294 os
.path
.walk(srcdir
, walk_helper
, file_list
)
301 #----------------------------------------------------------------------
320 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
321 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
324 #----------------------------------------------------------------------
325 # Setup some platform specific stuff
326 #----------------------------------------------------------------------
329 # Set compile flags and such for MSVC. These values are derived
330 # from the wxWindows makefiles for MSVC, other compilers settings
331 # will probably vary...
332 if os
.environ
.has_key('WXWIN'):
333 WXDIR
= os
.environ
['WXWIN']
335 msg("WARNING: WXWIN not set in environment.")
336 WXDIR
= '..' # assumes in CVS tree
341 opj(WXDIR
, 'lib', 'mswdll' + libFlag()),
342 opj(WXDIR
, 'include'),
345 defines
= [ ('WIN32', None),
348 ('__WINDOWS__', None),
349 ('WINVER', '0x0400'),
356 ('SWIG_GLOBAL', None),
357 ('HAVE_CONFIG_H', None),
358 ('WXP_USE_THREAD', '1'),
362 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
365 if not FINAL
or HYBRID
:
366 defines
.append( ('__WXDEBUG__', None) )
368 libdirs
= [ opj(WXDIR
, 'lib') ]
369 wxdll
= 'wxmsw' + WXDLLVER
+ libFlag()
372 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
373 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
374 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
375 'advapi32', 'wsock32']
379 # '/GX-' # workaround for internal compiler error in MSVC on some machines
383 # Other MSVC flags...
384 # To bad I don't remember why I was playing with these, can they be removed?
386 pass #cflags = cflags + ['/O1']
388 pass #cflags = cflags + ['/Ox']
390 pass # cflags = cflags + ['/Od', '/Z7']
391 # lflags = ['/DEBUG', ]
395 #----------------------------------------------------------------------
397 elif os
.name
== 'posix' and sys
.platform
[:6] == "darwin":
398 # Flags and such for a Darwin (Max OS X) build of Python
399 WXDIR
= '..' # assumes IN_CVS_TREE
404 defines
= [('SWIG_GLOBAL', None),
405 ('HAVE_CONFIG_H', None),
406 ('WXP_USE_THREAD', '1'),
409 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
415 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
416 cflags
= cflags
.split()
421 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
422 lflags
= lflags
.split()
427 #----------------------------------------------------------------------
429 elif os
.name
== 'posix':
430 # Set flags for other Unix type platforms
431 WXDIR
= '..' # assumes IN_CVS_TREE
436 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
437 elif WXPORT
== 'gtk2':
439 GENDIR
= 'gtk' # no code differences so use the same generated sources
440 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
441 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
442 elif WXPORT
== 'x11':
445 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
447 raise SystemExit, "Unknown WXPORT value: " + WXPORT
450 defines
= [('SWIG_GLOBAL', None),
451 ('HAVE_CONFIG_H', None),
452 ('WXP_USE_THREAD', '1'),
455 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
462 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1] + ' ' + portcfg
464 cflags
= cflags
.split()
469 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
470 lflags
= lflags
.split()
472 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
473 # wx-config doesn't output that for some reason. For now, just
474 # add it unconditionally but we should really check if the lib is
475 # really found there or wx-config should be fixed.
476 libdirs
.append("/usr/X11R6/lib")
479 #----------------------------------------------------------------------
481 raise 'Sorry Charlie, platform not supported...'
484 #----------------------------------------------------------------------
485 # post platform setup checks and tweaks
486 #----------------------------------------------------------------------
489 BUILD_BASE
= BUILD_BASE
+ '.unicode'
490 VERSION
= VERSION
+ 'u'
493 #----------------------------------------------------------------------
494 # Check if the version file needs updated
495 #----------------------------------------------------------------------
497 ##if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
499 # Always do it since the version string can change based on the UNICODE flag
500 open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION
)
504 #----------------------------------------------------------------------
506 #----------------------------------------------------------------------
509 swig_args
= ['-c++', '-shadow', '-python', '-keyword',
512 #'-docstring', '-Sbefore',
513 '-I./src', '-D'+WXPLAT
,
516 swig_args
.append('-DwxUSE_UNICODE')
518 swig_deps
= ['src/my_typemaps.i']
521 #----------------------------------------------------------------------
522 # Define the CORE extension module
523 #----------------------------------------------------------------------
525 msg('Preparing CORE...')
526 swig_files
= [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
527 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
528 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
529 'printfw.i', 'sizers.i', 'clip_dnd.i',
530 'filesys.i', 'streams.i', 'utils.i', 'fonts.i'
533 swig_sources
= run_swig(swig_files
, 'src', GENDIR
, PKGDIR
,
534 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
536 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
537 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0)
540 if IN_CVS_TREE
: # update the license files
542 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
543 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
547 build_locale_dir(opj(PKGDIR
, 'locale'))
548 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
552 rc_file
= ['src/wxc.rc']
557 ext
= Extension('wxc', ['src/helpers.cpp',
560 ] + rc_file
+ swig_sources
,
562 include_dirs
= includes
,
563 define_macros
= defines
,
565 library_dirs
= libdirs
,
568 extra_compile_args
= cflags
,
569 extra_link_args
= lflags
,
571 wxpExtensions
.append(ext
)
574 # Extension for the grid module
575 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
576 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
577 ext
= Extension('gridc', swig_sources
,
578 include_dirs
= includes
,
579 define_macros
= defines
,
580 library_dirs
= libdirs
,
582 extra_compile_args
= cflags
,
583 extra_link_args
= lflags
,
585 wxpExtensions
.append(ext
)
588 # Extension for the html modules
589 swig_sources
= run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR
, PKGDIR
,
590 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
591 ext
= Extension('htmlc', swig_sources
,
592 include_dirs
= includes
,
593 define_macros
= defines
,
594 library_dirs
= libdirs
,
596 extra_compile_args
= cflags
,
597 extra_link_args
= lflags
,
599 wxpExtensions
.append(ext
)
602 # Extension for the calendar module
603 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
604 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
605 ext
= Extension('calendarc', swig_sources
,
606 include_dirs
= includes
,
607 define_macros
= defines
,
608 library_dirs
= libdirs
,
610 extra_compile_args
= cflags
,
611 extra_link_args
= lflags
,
613 wxpExtensions
.append(ext
)
616 # Extension for the help module
617 swig_sources
= run_swig(['help.i'], 'src', GENDIR
, PKGDIR
,
618 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
619 ext
= Extension('helpc', swig_sources
,
620 include_dirs
= includes
,
621 define_macros
= defines
,
622 library_dirs
= libdirs
,
624 extra_compile_args
= cflags
,
625 extra_link_args
= lflags
,
627 wxpExtensions
.append(ext
)
630 # Extension for the wizard module
631 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
632 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
633 ext
= Extension('wizardc', swig_sources
,
634 include_dirs
= includes
,
635 define_macros
= defines
,
636 library_dirs
= libdirs
,
638 extra_compile_args
= cflags
,
639 extra_link_args
= lflags
,
641 wxpExtensions
.append(ext
)
644 #----------------------------------------------------------------------
645 # Define the GLCanvas extension module
646 #----------------------------------------------------------------------
648 CTRB_SRC
= opj(WXDIR
, 'contrib/src')
649 CTRB_INC
= opj(WXDIR
, 'contrib/include/wx')
652 msg('Preparing GLCANVAS...')
653 location
= 'contrib/glcanvas'
654 swig_files
= ['glcanvas.i']
657 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
658 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
661 if os
.name
== 'posix':
662 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
663 gl_lflags
= gl_config
.split() + lflags
666 other_sources
= [opj(location
, 'msw/myglcanvas.cpp')]
667 gl_libs
= libs
+ ['opengl32', 'glu32']
670 ext
= Extension('glcanvasc',
671 swig_sources
+ other_sources
,
673 include_dirs
= includes
,
674 define_macros
= defines
,
676 library_dirs
= libdirs
,
679 extra_compile_args
= cflags
,
680 extra_link_args
= gl_lflags
,
683 wxpExtensions
.append(ext
)
686 #----------------------------------------------------------------------
687 # Define the OGL extension module
688 #----------------------------------------------------------------------
691 msg('Preparing OGL...')
692 location
= 'contrib/ogl'
693 OGLLOC
= opj(location
, 'contrib/src/ogl')
694 OGLINC
= opj(location
, 'contrib/include')
696 swig_files
= ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
699 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
700 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
703 # make sure local copy of contrib files are up to date
704 contrib_copy_tree(opj(CTRB_INC
, 'ogl'), opj(OGLINC
, 'wx/ogl'))
705 contrib_copy_tree(opj(CTRB_SRC
, 'ogl'), OGLLOC
)
707 ext
= Extension('oglc', ['%s/basic.cpp' % OGLLOC
,
708 '%s/bmpshape.cpp' % OGLLOC
,
709 '%s/composit.cpp' % OGLLOC
,
710 '%s/divided.cpp' % OGLLOC
,
711 '%s/lines.cpp' % OGLLOC
,
712 '%s/misc.cpp' % OGLLOC
,
713 '%s/basic2.cpp' % OGLLOC
,
714 '%s/canvas.cpp' % OGLLOC
,
715 '%s/constrnt.cpp' % OGLLOC
,
716 '%s/drawn.cpp' % OGLLOC
,
717 '%s/mfutils.cpp' % OGLLOC
,
718 '%s/ogldiag.cpp' % OGLLOC
,
721 include_dirs
= [OGLINC
] + includes
,
722 define_macros
= defines
,
724 library_dirs
= libdirs
,
727 extra_compile_args
= cflags
,
728 extra_link_args
= lflags
,
731 wxpExtensions
.append(ext
)
735 #----------------------------------------------------------------------
736 # Define the STC extension module
737 #----------------------------------------------------------------------
740 msg('Preparing STC...')
741 location
= 'contrib/stc'
742 STCLOC
= opj(location
, 'contrib/src/stc')
743 STCINC
= opj(location
, 'contrib/include')
744 STC_H
= opj(location
, 'contrib/include/wx/stc')
747 # Check if gen_iface needs to be run for the wxSTC sources
748 if (newer(opj(CTRB_SRC
, 'stc/stc.h.in'), opj(CTRB_INC
, 'stc/stc.h' )) or
749 newer(opj(CTRB_SRC
, 'stc/stc.cpp.in'), opj(CTRB_SRC
, 'stc/stc.cpp')) or
750 newer(opj(CTRB_SRC
, 'stc/gen_iface.py'), opj(CTRB_SRC
, 'stc/stc.cpp'))):
752 msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
754 os
.chdir(opj(CTRB_SRC
, 'stc'))
755 sys
.path
.insert(0, os
.curdir
)
761 # make sure local copy of contrib files are up to date
762 contrib_copy_tree(opj(CTRB_INC
, 'stc'), opj(STCINC
, 'wx/stc'))
763 contrib_copy_tree(opj(CTRB_SRC
, 'stc'), STCLOC
)
767 swig_files
= ['stc_.i']
768 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
769 USE_SWIG
, swig_force
,
770 swig_args
+ ['-I'+STC_H
, '-I'+location
],
771 [opj(STC_H
, 'stc.h')] + swig_deps
)
773 # copy a contrib project specific py module to the main package dir
774 copy_file(opj(location
, 'stc.py'), PKGDIR
, update
=1, verbose
=0)
776 # add some include dirs to the standard set
777 stc_includes
= includes
[:]
778 stc_includes
.append('%s/scintilla/include' % STCLOC
)
779 stc_includes
.append('%s/scintilla/src' % STCLOC
)
780 stc_includes
.append(STCINC
)
782 # and some macro definitions
783 stc_defines
= defines
[:]
784 stc_defines
.append( ('__WX__', None) )
785 stc_defines
.append( ('SCI_LEXER', None) )
786 stc_defines
.append( ('LINK_LEXERS', None) )
789 ext
= Extension('stc_c',
790 ['%s/scintilla/src/AutoComplete.cxx' % STCLOC
,
791 '%s/scintilla/src/CallTip.cxx' % STCLOC
,
792 '%s/scintilla/src/CellBuffer.cxx' % STCLOC
,
793 '%s/scintilla/src/ContractionState.cxx' % STCLOC
,
794 '%s/scintilla/src/Document.cxx' % STCLOC
,
795 '%s/scintilla/src/DocumentAccessor.cxx' % STCLOC
,
796 '%s/scintilla/src/Editor.cxx' % STCLOC
,
797 '%s/scintilla/src/Indicator.cxx' % STCLOC
,
798 '%s/scintilla/src/KeyMap.cxx' % STCLOC
,
799 '%s/scintilla/src/KeyWords.cxx' % STCLOC
,
800 '%s/scintilla/src/LineMarker.cxx' % STCLOC
,
801 '%s/scintilla/src/PropSet.cxx' % STCLOC
,
802 '%s/scintilla/src/RESearch.cxx' % STCLOC
,
803 '%s/scintilla/src/ScintillaBase.cxx' % STCLOC
,
804 '%s/scintilla/src/Style.cxx' % STCLOC
,
805 '%s/scintilla/src/StyleContext.cxx' % STCLOC
,
806 '%s/scintilla/src/UniConversion.cxx' % STCLOC
,
807 '%s/scintilla/src/ViewStyle.cxx' % STCLOC
,
808 '%s/scintilla/src/WindowAccessor.cxx' % STCLOC
,
810 '%s/scintilla/src/LexAda.cxx' % STCLOC
,
811 '%s/scintilla/src/LexAVE.cxx' % STCLOC
,
812 '%s/scintilla/src/LexBaan.cxx' % STCLOC
,
813 '%s/scintilla/src/LexBullant.cxx' % STCLOC
,
814 '%s/scintilla/src/LexCPP.cxx' % STCLOC
,
815 '%s/scintilla/src/LexConf.cxx' % STCLOC
,
816 '%s/scintilla/src/LexCrontab.cxx' % STCLOC
,
817 '%s/scintilla/src/LexEiffel.cxx' % STCLOC
,
818 '%s/scintilla/src/LexHTML.cxx' % STCLOC
,
819 '%s/scintilla/src/LexLisp.cxx' % STCLOC
,
820 '%s/scintilla/src/LexLua.cxx' % STCLOC
,
821 '%s/scintilla/src/LexMatlab.cxx' % STCLOC
,
822 '%s/scintilla/src/LexOthers.cxx' % STCLOC
,
823 '%s/scintilla/src/LexPascal.cxx' % STCLOC
,
824 '%s/scintilla/src/LexPerl.cxx' % STCLOC
,
825 '%s/scintilla/src/LexPython.cxx' % STCLOC
,
826 '%s/scintilla/src/LexRuby.cxx' % STCLOC
,
827 '%s/scintilla/src/LexSQL.cxx' % STCLOC
,
828 '%s/scintilla/src/LexVB.cxx' % STCLOC
,
830 '%s/PlatWX.cpp' % STCLOC
,
831 '%s/ScintillaWX.cpp' % STCLOC
,
832 '%s/stc.cpp' % STCLOC
,
835 include_dirs
= stc_includes
,
836 define_macros
= stc_defines
,
838 library_dirs
= libdirs
,
841 extra_compile_args
= cflags
,
842 extra_link_args
= lflags
,
845 wxpExtensions
.append(ext
)
849 #----------------------------------------------------------------------
850 # Define the IEWIN extension module (experimental)
851 #----------------------------------------------------------------------
854 msg('Preparing IEWIN...')
855 location
= 'contrib/iewin'
857 swig_files
= ['iewin.i', ]
859 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
860 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
863 ext
= Extension('iewinc', ['%s/IEHtmlWin.cpp' % location
,
864 '%s/wxactivex.cpp' % location
,
867 include_dirs
= includes
,
868 define_macros
= defines
,
870 library_dirs
= libdirs
,
873 extra_compile_args
= cflags
,
874 extra_link_args
= lflags
,
877 wxpExtensions
.append(ext
)
880 #----------------------------------------------------------------------
881 # Define the XRC extension module
882 #----------------------------------------------------------------------
885 msg('Preparing XRC...')
886 location
= 'contrib/xrc'
887 XMLLOC
= opj(location
, 'contrib/src/xrc')
888 XMLINC
= opj(location
, 'contrib/include')
890 swig_files
= ['xrc.i']
892 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
893 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
895 xmlres_includes
= includes
[:]
896 xmlres_includes
.append('%s/expat/xmlparse' % XMLLOC
)
897 xmlres_includes
.append('%s/expat/xmltok' % XMLLOC
)
898 xmlres_includes
.append(XMLINC
)
901 # make sure local copy of contrib files are up to date
903 contrib_copy_tree(opj(CTRB_INC
, 'xrc'), opj(XMLINC
, 'wx/xrc'))
904 contrib_copy_tree(opj(CTRB_SRC
, 'xrc'), XMLLOC
)
906 ext
= Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC
,
907 '%s/expat/xmltok/xmlrole.c' % XMLLOC
,
908 '%s/expat/xmltok/xmltok.c' % XMLLOC
,
910 '%s/xh_bmp.cpp' % XMLLOC
,
911 '%s/xh_bmpbt.cpp' % XMLLOC
,
912 '%s/xh_bttn.cpp' % XMLLOC
,
913 '%s/xh_cald.cpp' % XMLLOC
,
914 '%s/xh_chckb.cpp' % XMLLOC
,
916 '%s/xh_chckl.cpp' % XMLLOC
,
917 '%s/xh_choic.cpp' % XMLLOC
,
918 '%s/xh_combo.cpp' % XMLLOC
,
919 '%s/xh_dlg.cpp' % XMLLOC
,
920 '%s/xh_frame.cpp' % XMLLOC
,
922 '%s/xh_gauge.cpp' % XMLLOC
,
923 '%s/xh_gdctl.cpp' % XMLLOC
,
924 '%s/xh_html.cpp' % XMLLOC
,
925 '%s/xh_listb.cpp' % XMLLOC
,
926 '%s/xh_listc.cpp' % XMLLOC
,
927 '%s/xh_menu.cpp' % XMLLOC
,
929 '%s/xh_notbk.cpp' % XMLLOC
,
930 '%s/xh_panel.cpp' % XMLLOC
,
931 '%s/xh_radbt.cpp' % XMLLOC
,
932 '%s/xh_radbx.cpp' % XMLLOC
,
933 '%s/xh_scrol.cpp' % XMLLOC
,
934 '%s/xh_scwin.cpp' % XMLLOC
,
936 '%s/xh_sizer.cpp' % XMLLOC
,
937 '%s/xh_slidr.cpp' % XMLLOC
,
938 '%s/xh_spin.cpp' % XMLLOC
,
939 '%s/xh_split.cpp' % XMLLOC
,
940 '%s/xh_stbmp.cpp' % XMLLOC
,
941 '%s/xh_stbox.cpp' % XMLLOC
,
943 '%s/xh_stlin.cpp' % XMLLOC
,
944 '%s/xh_sttxt.cpp' % XMLLOC
,
945 '%s/xh_text.cpp' % XMLLOC
,
946 '%s/xh_toolb.cpp' % XMLLOC
,
947 '%s/xh_tree.cpp' % XMLLOC
,
949 '%s/xh_unkwn.cpp' % XMLLOC
,
950 '%s/xml.cpp' % XMLLOC
,
951 '%s/xmlres.cpp' % XMLLOC
,
952 '%s/xmlrsall.cpp' % XMLLOC
,
956 include_dirs
= xmlres_includes
,
957 define_macros
= defines
,
959 library_dirs
= libdirs
,
962 extra_compile_args
= cflags
,
963 extra_link_args
= lflags
,
966 wxpExtensions
.append(ext
)
970 #----------------------------------------------------------------------
971 # Define the GIZMOS extension module
972 #----------------------------------------------------------------------
975 msg('Preparing GIZMOS...')
976 location
= 'contrib/gizmos'
977 GIZMOLOC
= opj(location
, 'contrib/src/gizmos')
978 GIZMOINC
= opj(location
, 'contrib/include')
980 swig_files
= ['gizmos.i']
982 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
983 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
985 gizmos_includes
= includes
[:]
986 gizmos_includes
.append(GIZMOINC
)
989 # make sure local copy of contrib files are up to date
991 contrib_copy_tree(opj(CTRB_INC
, 'gizmos'), opj(GIZMOINC
, 'wx/gizmos'))
992 contrib_copy_tree(opj(CTRB_SRC
, 'gizmos'), GIZMOLOC
)
994 ext
= Extension('gizmosc', [
995 '%s/dynamicsash.cpp' % GIZMOLOC
,
996 '%s/editlbox.cpp' % GIZMOLOC
,
997 #'%s/multicell.cpp' % GIZMOLOC,
998 '%s/splittree.cpp' % GIZMOLOC
,
999 '%s/ledctrl.cpp' % GIZMOLOC
,
1002 include_dirs
= gizmos_includes
,
1003 define_macros
= defines
,
1005 library_dirs
= libdirs
,
1008 extra_compile_args
= cflags
,
1009 extra_link_args
= lflags
,
1012 wxpExtensions
.append(ext
)
1016 #----------------------------------------------------------------------
1017 # Define the DLLWIDGET extension module
1018 #----------------------------------------------------------------------
1021 msg('Preparing DLLWIDGET...')
1022 location
= 'contrib/dllwidget'
1023 swig_files
= ['dllwidget_.i']
1025 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1026 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1028 # copy a contrib project specific py module to the main package dir
1029 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
1031 ext
= Extension('dllwidget_c', [
1032 '%s/dllwidget.cpp' % location
,
1035 include_dirs
= includes
,
1036 define_macros
= defines
,
1038 library_dirs
= libdirs
,
1041 extra_compile_args
= cflags
,
1042 extra_link_args
= lflags
,
1045 wxpExtensions
.append(ext
)
1048 #----------------------------------------------------------------------
1049 # Define the CANVAS extension module
1050 #----------------------------------------------------------------------
1053 msg('Preparing CANVAS...')
1054 location
= 'contrib/canvas'
1055 CANVASLOC
= opj(location
, 'contrib/src/canvas')
1056 CANVASINC
= opj(location
, 'contrib/include')
1058 swig_files
= ['canvas.i']
1060 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1061 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1064 # make sure local copy of contrib files are up to date
1065 contrib_copy_tree(opj(CTRB_INC
, 'canvas'), opj(CANVASINC
, 'wx/canvas'))
1066 contrib_copy_tree(opj(CTRB_SRC
, 'canvas'), CANVASLOC
)
1068 ext
= Extension('canvasc', ['%s/bbox.cpp' % CANVASLOC
,
1069 '%s/liner.cpp' % CANVASLOC
,
1070 '%s/polygon.cpp' % CANVASLOC
,
1071 '%s/canvas.cpp' % CANVASLOC
,
1074 include_dirs
= [CANVASINC
] + includes
,
1075 define_macros
= defines
,
1077 library_dirs
= libdirs
,
1080 extra_compile_args
= cflags
,
1081 extra_link_args
= lflags
,
1084 wxpExtensions
.append(ext
)
1087 #----------------------------------------------------------------------
1088 # Define the ART2D extension module
1089 #----------------------------------------------------------------------
1092 msg('Preparing ART2D...')
1093 location
= 'contrib/art2d'
1094 ART2DLOC
= opj(location
, 'modules/canvas/src')
1095 ART2DINC
= opj(location
, 'modules/canvas/include')
1096 EXPATLOC
= opj(location
, 'modules/expat')
1097 EXPATINC
= opj(location
, 'modules/expat/include')
1099 swig_files
= ['art2d.i',
1105 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1106 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1109 # Don't copy data in this case as the code snapshots are
1113 ext
= Extension('art2dc', [ opj(ART2DLOC
, 'afmatrix.cpp'),
1114 opj(ART2DLOC
, 'bbox.cpp'),
1115 opj(ART2DLOC
, 'cancom.cpp'),
1116 opj(ART2DLOC
, 'candoc.cpp'),
1117 opj(ART2DLOC
, 'canglob.cpp'),
1118 opj(ART2DLOC
, 'canobj3d.cpp'),
1119 opj(ART2DLOC
, 'canobj.cpp'),
1120 opj(ART2DLOC
, 'canprim.cpp'),
1121 opj(ART2DLOC
, 'canprop.cpp'),
1122 opj(ART2DLOC
, 'canvas.cpp'),
1123 opj(ART2DLOC
, 'docviewref.cpp'),
1124 opj(ART2DLOC
, 'drawer.cpp'),
1125 opj(ART2DLOC
, 'eval.cpp'),
1126 opj(ART2DLOC
, 'graph.cpp'),
1127 opj(ART2DLOC
, 'layerinf.cpp'),
1128 opj(ART2DLOC
, 'liner.cpp'),
1129 opj(ART2DLOC
, 'meta.cpp'),
1130 opj(ART2DLOC
, 'objlist.cpp'),
1131 opj(ART2DLOC
, 'polygon.cpp'),
1132 opj(ART2DLOC
, 'recur.cpp'),
1133 opj(ART2DLOC
, 'rendimg.cpp'),
1134 opj(ART2DLOC
, 'tools.cpp'),
1135 opj(ART2DLOC
, 'vpath.cpp'),
1136 opj(ART2DLOC
, 'xmlpars.cpp'),
1138 opj(EXPATLOC
, 'xmlparse/xmlparse.c'),
1139 opj(EXPATLOC
, 'xmltok/xmlrole.c'),
1140 opj(EXPATLOC
, 'xmltok/xmltok.c'),
1144 include_dirs
= [ ART2DINC
,
1146 opj(EXPATLOC
, 'xmltok'),
1147 opj(EXPATLOC
, 'xmlparse'),
1149 define_macros
= defines
,
1151 library_dirs
= libdirs
,
1154 extra_compile_args
= cflags
,
1155 extra_link_args
= lflags
,
1158 wxpExtensions
.append(ext
)
1161 #----------------------------------------------------------------------
1163 #----------------------------------------------------------------------
1168 SCRIPTS
= [opj('scripts/helpviewer'),
1169 opj('scripts/img2png'),
1170 opj('scripts/img2xpm'),
1171 opj('scripts/img2py'),
1172 opj('scripts/xrced'),
1173 opj('scripts/pyshell'),
1174 opj('scripts/pycrust'),
1175 opj('scripts/pycwrap'),
1179 DATA_FILES
.append( ('wxPython/tools/XRCed', glob
.glob('wxPython/tools/XRCed/*.txt') +
1180 [ 'wxPython/tools/XRCed/xrced.xrc']))
1182 DATA_FILES
.append( ('wxPython/lib/PyCrust', glob
.glob('wxPython/lib/PyCrust/*.txt') +
1183 glob
.glob('wxPython/lib/PyCrust/*.ico')))
1186 #----------------------------------------------------------------------
1187 # Do the Setup/Build/Install/Whatever
1188 #----------------------------------------------------------------------
1190 if __name__
== "__main__":
1192 setup(name
= PKGDIR
,
1194 description
= DESCRIPTION
,
1195 long_description
= LONG_DESCRIPTION
,
1197 author_email
= AUTHOR_EMAIL
,
1203 PKGDIR
+'.lib.colourchooser',
1204 PKGDIR
+'.lib.editor',
1205 PKGDIR
+'.lib.mixins',
1206 PKGDIR
+'.lib.PyCrust',
1207 PKGDIR
+'.lib.PyCrust.wxd',
1209 PKGDIR
+'.tools.XRCed',
1212 ext_package
= PKGDIR
,
1213 ext_modules
= wxpExtensions
,
1215 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1219 cmdclass
= { 'install_data': smart_install_data}
,
1220 data_files
= DATA_FILES
,
1225 #----------------------------------------------------------------------
1226 #----------------------------------------------------------------------