2 #----------------------------------------------------------------------
4 import sys
, os
, glob
, fnmatch
, tempfile
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
= 1 # wxPython release num for x.y.z release of wxWindows
20 VER_FLAGS
= "" # 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 DOWNLOAD_URL
= "http://wxPython.org/download.php"
27 LICENSE
= "wxWindows Library License (LGPL derivative)"
28 PLATFORMS
= "WIN32,OSX,POSIX"
29 KEYWORDS
= "GUI,wx,wxWindows,cross-platform"
31 LONG_DESCRIPTION
= """\
32 wxPython is a GUI toolkit for Python that is a wrapper around the
33 wxWindows C++ GUI library. wxPython provides a large variety of
34 window types and controls, all implemented with a native look and
35 feel (by using the native widgets) on the platforms it is supported
40 Development Status :: 6 - Mature
41 Environment :: MacOS X :: Carbon
42 Environment :: Win32 (MS Windows)
43 Environment :: X11 Applications :: GTK
44 Intended Audience :: Developers
45 License :: OSI Approved
46 Operating System :: MacOS :: MacOS X
47 Operating System :: Microsoft :: Windows :: Windows 95/98/2000
48 Operating System :: POSIX
49 Programming Language :: Python
50 Topic :: Software Development :: User Interfaces
53 ## License :: OSI Approved :: wxWindows Library Licence
56 # Config values below this point can be reset on the setup.py command line.
58 BUILD_GLCANVAS
= 1 # If true, build the contrib/glcanvas extension module
59 BUILD_OGL
= 1 # If true, build the contrib/ogl extension module
60 BUILD_STC
= 1 # If true, build the contrib/stc extension module
61 BUILD_XRC
= 1 # XML based resource system
62 BUILD_GIZMOS
= 1 # Build a module for the gizmos contrib library
63 BUILD_DLLWIDGET
= 0# Build a module that enables unknown wx widgets
64 # to be loaded from a DLL and to be used from Python.
66 # Internet Explorer wrapper (experimental)
67 BUILD_IEWIN
= (os
.name
== 'nt')
70 CORE_ONLY
= 0 # if true, don't build any of the above
72 PREP_ONLY
= 0 # Only run the prepatory steps, not the actual build.
74 USE_SWIG
= 0 # Should we actually execute SWIG, or just use the
75 # files already in the distribution?
77 SWIG
= "swig" # The swig executable to use.
79 BUILD_RENAMERS
= 1 # Should we build the renamer modules too?
81 UNICODE
= 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
82 # will ensure that the right headers are found and the
83 # right libs are linked.
85 UNDEF_NDEBUG
= 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
86 # and distutils will pick this up and use it on the
87 # compile command-line for the extensions. This could
88 # conflict with how wxWindows was built. If NDEBUG is
89 # set then wxWindows' __WXDEBUG__ setting will be turned
90 # off. If wxWindows was actually built with it turned
91 # on then you end up with mismatched class structures,
92 # and wxPython will crash.
94 NO_SCRIPTS
= 0 # Don't install the tool scripts
96 WX_CONFIG
= None # Usually you shouldn't need to touch this, but you can set
97 # it to pass an alternate version of wx-config or alternate
98 # flags, eg. as required by the .deb in-tree build. By
99 # default a wx-config command will be assembled based on
100 # version, port, etc. and it will be looked for on the
103 WXPORT
= 'gtk' # On Linux/Unix there are several ports of wxWindows available.
104 # Setting this value lets you select which will be used for
105 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
106 # 'x11'. Curently only gtk and gtk2 works.
108 BUILD_BASE
= "build" # Directory to use for temporary build files.
110 CONTRIBS_INC
= "" # A dir to add as an -I flag when compiling the contribs
113 # Some MSW build settings
115 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
116 # (0 or 1 only) should probably find a way to
119 HYBRID
= 1 # If set and not debug or FINAL, then build a
120 # hybrid extension that can be used by the
121 # non-debug version of python, but contains
122 # debugging symbols for wxWindows and wxPython.
123 # wxWindows must have been built with /MD, not /MDd
124 # (using FINAL=hybrid will do it.)
126 # Version part of wxWindows LIB/DLL names
127 WXDLLVER
= '%d%d' % (VER_MAJOR
, VER_MINOR
)
130 #----------------------------------------------------------------------
133 if __name__
== "__main__":
138 path
= apply(os
.path
.join
, args
)
139 return os
.path
.normpath(path
)
154 #----------------------------------------------------------------------
156 #----------------------------------------------------------------------
162 force
= '--force' in sys
.argv
or '-f' in sys
.argv
163 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
164 cleaning
= 'clean' in sys
.argv
167 # change the PORT default for wxMac
168 if sys
.platform
[:6] == "darwin":
171 # and do the same for wxMSW, just for consistency
176 #----------------------------------------------------------------------
177 # Check for build flags on the command line
178 #----------------------------------------------------------------------
180 # Boolean (int) flags
181 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
182 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
183 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE',
184 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'BUILD_RENAMERS',
185 'FINAL', 'HYBRID', ]:
186 for x
in range(len(sys
.argv
)):
187 if sys
.argv
[x
].find(flag
) == 0:
188 pos
= sys
.argv
[x
].find('=') + 1
190 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
194 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG',
196 for x
in range(len(sys
.argv
)):
197 if sys
.argv
[x
].find(option
) == 0:
198 pos
= sys
.argv
[x
].find('=') + 1
200 vars()[option
] = sys
.argv
[x
][pos
:]
203 sys
.argv
= filter(None, sys
.argv
)
206 #----------------------------------------------------------------------
207 # some helper functions
208 #----------------------------------------------------------------------
210 def Verify_WX_CONFIG():
211 """ Called below for the builds that need wx-config,
212 if WX_CONFIG is not set then tries to select the specific
213 wx*-config script based on build options. If not found
214 then it defaults to 'wx-config'.
216 # if WX_CONFIG hasn't been set to an explicit value then construct one.
218 if WX_CONFIG
is None:
219 if debug
: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows...
227 ver2
= "%s.%s" % (VER_MAJOR
, VER_MINOR
)
231 WX_CONFIG
= 'wx%s%s%s-%s-config' % (port
, uf
, df
, ver2
)
233 searchpath
= os
.environ
["PATH"]
234 for p
in searchpath
.split(':'):
235 fp
= os
.path
.join(p
, WX_CONFIG
)
236 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
238 msg("Found wx-config: " + fp
)
242 msg("WX_CONFIG not specified and %s not found on $PATH "
243 "defaulting to \"wx-config\"" % WX_CONFIG
)
244 WX_CONFIG
= 'wx-config'
248 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
249 """Run SWIG the way I want it done"""
251 if not os
.path
.exists(os
.path
.join(dir, gendir
)):
252 os
.mkdir(os
.path
.join(dir, gendir
))
254 if not os
.path
.exists(os
.path
.join("docs", "xml-raw")):
255 os
.mkdir(os
.path
.join("docs", "xml-raw"))
260 basefile
= os
.path
.splitext(file)[0]
261 i_file
= os
.path
.join(dir, file)
262 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
263 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'_wrap.cpp')
264 xml_file
= os
.path
.join("docs", "xml-raw", basefile
+'_swig.xml')
266 sources
.append(cpp_file
)
268 if not cleaning
and USE_SWIG
:
269 for dep
in swig_deps
:
270 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
274 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
275 ## we need forward slashes here even on win32
276 #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\'))
277 #i_file = opj(i_file) #'/'.join(i_file.split('\\'))
280 #tempfile.tempdir = sourcePath
281 xmltemp
= tempfile
.mktemp('.xml')
283 # First run swig to produce the XML file, adding
284 # an extra -D that prevents the old rename
285 # directives from being used
286 cmd
= [ swig_cmd
] + swig_args
+ \
287 [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp
] + \
288 ['-I'+dir, '-o', cpp_file
, i_file
]
292 # Next run build_renamers to process the XML
293 cmd
= [ sys
.executable
, '-u',
294 './distrib/build_renamers.py', dir, basefile
, xmltemp
]
299 # Then run swig for real
300 cmd
= [ swig_cmd
] + swig_args
+ ['-I'+dir, '-o', cpp_file
,
301 '-xmlout', xml_file
, i_file
]
306 # copy the generated python file to the package directory
307 copy_file(py_file
, package
, update
=not force
, verbose
=0)
313 def contrib_copy_tree(src
, dest
, verbose
=0):
314 """Update local copies of wxWindows contrib files"""
315 from distutils
.dir_util
import mkpath
, copy_tree
317 mkpath(dest
, verbose
=verbose
)
318 copy_tree(src
, dest
, update
=1, verbose
=verbose
)
322 class smart_install_data(install_data
):
324 #need to change self.install_dir to the actual library dir
325 install_cmd
= self
.get_finalized_command('install')
326 self
.install_dir
= getattr(install_cmd
, 'install_lib')
327 return install_data
.run(self
)
330 def build_locale_dir(destdir
, verbose
=1):
331 """Build a locale dir under the wxPython package for MSW"""
332 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
334 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
335 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
336 mkpath(dest
, verbose
=verbose
)
337 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
340 def build_locale_list(srcdir
):
341 # get a list of all files under the srcdir, to be used for install_data
342 def walk_helper(lst
, dirname
, files
):
344 filename
= opj(dirname
, f
)
345 if not os
.path
.isdir(filename
):
346 lst
.append( (dirname
, [filename
]) )
348 os
.path
.walk(srcdir
, walk_helper
, file_list
)
352 def find_data_files(srcdir
, *wildcards
):
353 # get a list of all files under the srcdir matching wildcards,
354 # returned in a format to be used for install_data
356 def walk_helper(arg
, dirname
, files
):
361 filename
= opj(dirname
, f
)
362 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
):
363 names
.append(filename
)
365 lst
.append( (dirname
, names
) )
368 os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
))
372 def makeLibName(name
):
373 if os
.name
== 'posix':
374 libname
= '%s_%s-%s' % (WXBASENAME
, name
, WXRELEASE
)
376 libname
= 'wxmsw%s%s_%s' % (WXDLLVER
, libFlag(), name
)
382 def adjustCFLAGS(cflags
, defines
, includes
):
383 '''Extrace the raw -I, -D, and -U flags and put them into
384 defines and includes as needed.'''
388 includes
.append(flag
[2:])
389 elif flag
[:2] == '-D':
391 if flag
.find('=') == -1:
392 defines
.append( (flag
, None) )
394 defines
.append( tuple(flag
.split('=')) )
395 elif flag
[:2] == '-U':
396 defines
.append( (flag
[2:], ) )
398 newCFLAGS
.append(flag
)
403 def adjustLFLAGS(lfags
, libdirs
, libs
):
404 '''Extrace the -L and -l flags and put them in libdirs and libs as needed'''
408 libdirs
.append(flag
[2:])
409 elif flag
[:2] == '-l':
410 libs
.append(flag
[2:])
412 newLFLAGS
.append(flag
)
416 #----------------------------------------------------------------------
435 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
436 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
439 #----------------------------------------------------------------------
440 # Setup some platform specific stuff
441 #----------------------------------------------------------------------
444 # Set compile flags and such for MSVC. These values are derived
445 # from the wxWindows makefiles for MSVC, other compilers settings
446 # will probably vary...
447 if os
.environ
.has_key('WXWIN'):
448 WXDIR
= os
.environ
['WXWIN']
450 msg("WARNING: WXWIN not set in environment.")
451 WXDIR
= '..' # assumes in CVS tree
455 includes
= ['include', 'src',
456 opj(WXDIR
, 'lib', 'vc_dll', 'msw' + libFlag()),
457 opj(WXDIR
, 'include'),
458 opj(WXDIR
, 'contrib', 'include'),
461 defines
= [ ('WIN32', None),
467 ('SWIG_GLOBAL', None),
468 ('WXP_USE_THREAD', '1'),
472 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
475 defines
.append( ('__NO_VC_CRTDBG__', None) )
477 if not FINAL
or HYBRID
:
478 defines
.append( ('__WXDEBUG__', None) )
480 libdirs
= [ opj(WXDIR
, 'lib', 'vc_dll') ]
481 libs
= [ 'wxbase' + WXDLLVER
+ libFlag(), # TODO: trim this down to what is really needed for the core
482 'wxbase' + WXDLLVER
+ libFlag() + '_net',
483 'wxbase' + WXDLLVER
+ libFlag() + '_xml',
484 makeLibName('core')[0],
485 makeLibName('adv')[0],
486 makeLibName('html')[0],
489 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
490 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
491 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
492 'advapi32', 'wsock32']
496 # '/GX-' # workaround for internal compiler error in MSVC on some machines
500 # Other MSVC flags...
501 # Too bad I don't remember why I was playing with these, can they be removed?
503 pass #cflags = cflags + ['/O1']
505 pass #cflags = cflags + ['/Ox']
507 pass # cflags = cflags + ['/Od', '/Z7']
508 # lflags = ['/DEBUG', ]
512 #----------------------------------------------------------------------
514 elif os
.name
== 'posix':
516 includes
= ['include', 'src']
517 defines
= [('SWIG_GLOBAL', None),
518 ('HAVE_CONFIG_H', None),
519 ('WXP_USE_THREAD', '1'),
522 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
529 # If you get unresolved symbol errors on Solaris and are using gcc, then
530 # uncomment this block to add the right flags to the link step and build
532 ## if os.uname()[0] == 'SunOS':
533 ## libs.append('gcc')
534 ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
536 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
537 cflags
= cflags
.split()
544 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
545 lflags
= lflags
.split()
547 WXBASENAME
= os
.popen(WX_CONFIG
+ ' --basename').read()[:-1]
548 WXRELEASE
= os
.popen(WX_CONFIG
+ ' --release').read()[:-1]
549 WXPREFIX
= os
.popen(WX_CONFIG
+ ' --prefix').read()[:-1]
552 if sys
.platform
[:6] == "darwin":
553 # Flags and such for a Darwin (Max OS X) build of Python
561 # Set flags for other Unix type platforms
566 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
567 elif WXPORT
== 'gtk2':
569 GENDIR
= 'gtk' # no code differences so use the same generated sources
570 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
571 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
572 elif WXPORT
== 'x11':
575 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
577 raise SystemExit, "Unknown WXPORT value: " + WXPORT
579 cflags
+= portcfg
.split()
581 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
582 # wx-config doesn't output that for some reason. For now, just
583 # add it unconditionally but we should really check if the lib is
584 # really found there or wx-config should be fixed.
585 libdirs
.append("/usr/X11R6/lib")
588 # Move the various -I, -D, etc. flags we got from the *config scripts
589 # into the distutils lists.
590 cflags
= adjustCFLAGS(cflags
, defines
, includes
)
591 lflags
= adjustLFLAGS(lflags
, libdirs
, libs
)
594 #----------------------------------------------------------------------
596 raise 'Sorry, platform not supported...'
599 #----------------------------------------------------------------------
600 # post platform setup checks and tweaks, create the full version string
601 #----------------------------------------------------------------------
604 BUILD_BASE
= BUILD_BASE
+ '.unicode'
608 VERSION
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
,
609 VER_SUBREL
, VER_FLAGS
)
611 #----------------------------------------------------------------------
612 # Update the version file
613 #----------------------------------------------------------------------
615 # Unconditionally updated since the version string can change based
616 # on the UNICODE flag
617 open('src/__version__.py', 'w').write("""\
618 # This file was generated by setup.py...
620 VERSION_STRING = '%(VERSION)s'
621 MAJOR_VERSION = %(VER_MAJOR)s
622 MINOR_VERSION = %(VER_MINOR)s
623 RELEASE_VERSION = %(VER_RELEASE)s
624 SUBREL_VERSION = %(VER_SUBREL)s
626 VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION,
627 SUBREL_VERSION, '%(VER_FLAGS)s')
629 RELEASE_NUMBER = RELEASE_VERSION # for compatibility
635 #----------------------------------------------------------------------
637 #----------------------------------------------------------------------
657 swig_args
.append('-DwxUSE_UNICODE')
659 swig_deps
= [ 'src/my_typemaps.i',
664 depends
= [ #'include/wx/wxPython/wxPython.h',
665 #'include/wx/wxPython/wxPython_int.h',
670 #----------------------------------------------------------------------
671 # Define the CORE extension module
672 #----------------------------------------------------------------------
674 msg('Preparing CORE...')
675 swig_sources
= run_swig(['core.i'], 'src', GENDIR
, PKGDIR
,
676 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
680 'src/_constraints.i',
683 'src/_core_rename.i',
684 'src/_core_reverse.txt',
702 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
703 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0)
706 # update the license files
708 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
709 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
713 build_locale_dir(opj(PKGDIR
, 'locale'))
714 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
718 rc_file
= ['src/wxc.rc']
723 ext
= Extension('_core', ['src/helpers.cpp',
725 ] + rc_file
+ swig_sources
,
727 include_dirs
= includes
,
728 define_macros
= defines
,
730 library_dirs
= libdirs
,
733 extra_compile_args
= cflags
,
734 extra_link_args
= lflags
,
738 wxpExtensions
.append(ext
)
744 # Extension for the GDI module
745 swig_sources
= run_swig(['gdi.i'], 'src', GENDIR
, PKGDIR
,
746 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
747 ['src/_gdi_rename.i',
748 'src/_bitmap.i', 'src/_brush.i',
749 'src/_colour.i', 'src/_cursor.i',
750 'src/_dc.i', 'src/_font.i',
751 'src/_gdiobj.i', 'src/_icon.i',
752 'src/_imaglist.i', 'src/_pen.i',
753 'src/_region.i', 'src/_palette.i',
759 ext
= Extension('_gdi', ['src/drawlist.cpp'] + swig_sources
,
760 include_dirs
= includes
,
761 define_macros
= defines
,
762 library_dirs
= libdirs
,
764 extra_compile_args
= cflags
,
765 extra_link_args
= lflags
,
768 wxpExtensions
.append(ext
)
775 # Extension for the windows module
776 swig_sources
= run_swig(['windows.i'], 'src', GENDIR
, PKGDIR
,
777 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
778 ['src/_windows_rename.i', 'src/_windows_reverse.txt',
780 'src/_toplvl.i', 'src/_statusbar.i',
781 'src/_splitter.i', 'src/_sashwin.i',
782 'src/_popupwin.i', 'src/_tipwin.i',
783 'src/_vscroll.i', 'src/_taskbar.i',
784 'src/_cmndlgs.i', 'src/_mdi.i',
785 'src/_pywindows.i', 'src/_printfw.i',
787 ext
= Extension('_windows', swig_sources
,
788 include_dirs
= includes
,
789 define_macros
= defines
,
790 library_dirs
= libdirs
,
792 extra_compile_args
= cflags
,
793 extra_link_args
= lflags
,
796 wxpExtensions
.append(ext
)
801 # Extension for the controls module
802 swig_sources
= run_swig(['controls.i'], 'src', GENDIR
, PKGDIR
,
803 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
804 [ 'src/_controls_rename.i', 'src/_controls_reverse.txt',
806 'src/_button.i', 'src/_checkbox.i',
807 'src/_choice.i', 'src/_combobox.i',
808 'src/_gauge.i', 'src/_statctrls.i',
809 'src/_listbox.i', 'src/_textctrl.i',
810 'src/_scrolbar.i', 'src/_spin.i',
811 'src/_radio.i', 'src/_slider.i',
812 'src/_tglbtn.i', 'src/_notebook.i',
813 'src/_listctrl.i', 'src/_treectrl.i',
814 'src/_dirctrl.i', 'src/_pycontrol.i',
815 'src/_cshelp.i', 'src/_dragimg.i',
817 ext
= Extension('_controls', swig_sources
,
818 include_dirs
= includes
,
819 define_macros
= defines
,
820 library_dirs
= libdirs
,
822 extra_compile_args
= cflags
,
823 extra_link_args
= lflags
,
826 wxpExtensions
.append(ext
)
831 # Extension for the misc module
832 swig_sources
= run_swig(['misc.i'], 'src', GENDIR
, PKGDIR
,
833 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
834 [ 'src/_settings.i', 'src/_functions.i',
835 'src/_misc.i', 'src/_tipdlg.i',
836 'src/_timer.i', 'src/_log.i',
837 'src/_process.i', 'src/_joystick.i',
838 'src/_sound.i', 'src/_mimetype.i',
839 'src/_artprov.i', 'src/_config.i',
840 'src/_datetime.i', 'src/_dataobj.i',
841 'src/_dnd.i', 'src/_display.i',
844 ext
= Extension('_misc', swig_sources
,
845 include_dirs
= includes
,
846 define_macros
= defines
,
847 library_dirs
= libdirs
,
849 extra_compile_args
= cflags
,
850 extra_link_args
= lflags
,
853 wxpExtensions
.append(ext
)
858 ## Core modules that are not in the "core" namespace start here
861 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
862 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
863 ext
= Extension('_calendar', swig_sources
,
864 include_dirs
= includes
,
865 define_macros
= defines
,
866 library_dirs
= libdirs
,
868 extra_compile_args
= cflags
,
869 extra_link_args
= lflags
,
872 wxpExtensions
.append(ext
)
875 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
876 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
877 ext
= Extension('_grid', swig_sources
,
878 include_dirs
= includes
,
879 define_macros
= defines
,
880 library_dirs
= libdirs
,
882 extra_compile_args
= cflags
,
883 extra_link_args
= lflags
,
886 wxpExtensions
.append(ext
)
890 swig_sources
= run_swig(['html.i'], 'src', GENDIR
, PKGDIR
,
891 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
892 ext
= Extension('_html', swig_sources
,
893 include_dirs
= includes
,
894 define_macros
= defines
,
895 library_dirs
= libdirs
,
897 extra_compile_args
= cflags
,
898 extra_link_args
= lflags
,
901 wxpExtensions
.append(ext
)
905 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
906 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
907 ext
= Extension('_wizard', swig_sources
,
908 include_dirs
= includes
,
909 define_macros
= defines
,
910 library_dirs
= libdirs
,
912 extra_compile_args
= cflags
,
913 extra_link_args
= lflags
,
916 wxpExtensions
.append(ext
)
919 #----------------------------------------------------------------------
922 includes
+= [ CONTRIBS_INC
]
924 #----------------------------------------------------------------------
925 # Define the GLCanvas extension module
926 #----------------------------------------------------------------------
929 msg('Preparing GLCANVAS...')
930 location
= 'contrib/glcanvas'
932 swig_sources
= run_swig(['glcanvas.i'], location
, GENDIR
, PKGDIR
,
933 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
936 if os
.name
== 'posix':
937 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
938 gl_lflags
= gl_config
.split() + lflags
941 gl_libs
= libs
+ ['opengl32', 'glu32'] + makeLibName('gl')
944 ext
= Extension('_glcanvas',
947 include_dirs
= includes
,
948 define_macros
= defines
,
950 library_dirs
= libdirs
,
953 extra_compile_args
= cflags
,
954 extra_link_args
= gl_lflags
,
957 wxpExtensions
.append(ext
)
960 #----------------------------------------------------------------------
961 # Define the OGL extension module
962 #----------------------------------------------------------------------
965 msg('Preparing OGL...')
966 location
= 'contrib/ogl'
968 swig_sources
= run_swig(['ogl.i'], location
, GENDIR
, PKGDIR
,
969 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
970 [ '%s/_oglbasic.i' % location
,
971 '%s/_oglshapes.i' % location
,
972 '%s/_oglshapes2.i' % location
,
973 '%s/_oglcanvas.i' % location
,
974 '%s/_ogldefs.i' % location
,
977 ext
= Extension('_ogl',
980 include_dirs
= includes
+ [ location
],
981 define_macros
= defines
+ [('wxUSE_DEPRECATED', '0')],
983 library_dirs
= libdirs
,
984 libraries
= libs
+ makeLibName('ogl'),
986 extra_compile_args
= cflags
,
987 extra_link_args
= lflags
,
990 wxpExtensions
.append(ext
)
994 #----------------------------------------------------------------------
995 # Define the STC extension module
996 #----------------------------------------------------------------------
999 msg('Preparing STC...')
1000 location
= 'contrib/stc'
1002 STC_H
= opj(WXDIR
, 'contrib', 'include/wx/stc')
1004 STC_H
= opj(WXPREFIX
, 'include/wx/stc')
1006 ## NOTE: need to add something like this to the stc.bkl...
1008 ## # Check if gen_iface needs to be run for the wxSTC sources
1009 ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
1010 ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
1011 ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
1013 ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
1014 ## cwd = os.getcwd()
1015 ## os.chdir(opj(CTRB_SRC, 'stc'))
1016 ## sys.path.insert(0, os.curdir)
1018 ## gen_iface.main([])
1022 swig_sources
= run_swig(['stc.i'], location
, '', PKGDIR
,
1023 USE_SWIG
, swig_force
,
1024 swig_args
+ ['-I'+STC_H
, '-I'+location
],
1025 [opj(STC_H
, 'stc.h')] + swig_deps
)
1027 ext
= Extension('_stc',
1030 include_dirs
= includes
,
1031 define_macros
= defines
,
1033 library_dirs
= libdirs
,
1034 libraries
= libs
+ makeLibName('stc'),
1036 extra_compile_args
= cflags
,
1037 extra_link_args
= lflags
,
1040 wxpExtensions
.append(ext
)
1044 #----------------------------------------------------------------------
1045 # Define the IEWIN extension module (experimental)
1046 #----------------------------------------------------------------------
1049 msg('Preparing IEWIN...')
1050 location
= 'contrib/iewin'
1052 swig_files
= ['iewin.i', ]
1054 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1055 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1058 ext
= Extension('_iewin', ['%s/IEHtmlWin.cpp' % location
,
1059 '%s/wxactivex.cpp' % location
,
1062 include_dirs
= includes
,
1063 define_macros
= defines
,
1065 library_dirs
= libdirs
,
1068 extra_compile_args
= cflags
,
1069 extra_link_args
= lflags
,
1072 wxpExtensions
.append(ext
)
1075 #----------------------------------------------------------------------
1076 # Define the XRC extension module
1077 #----------------------------------------------------------------------
1080 msg('Preparing XRC...')
1081 location
= 'contrib/xrc'
1083 swig_sources
= run_swig(['xrc.i'], location
, '', PKGDIR
,
1084 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
1085 [ '%s/_xrc_rename.i' % location
,
1086 '%s/_xrc_ex.py' % location
,
1087 '%s/_xmlres.i' % location
,
1088 '%s/_xmlsub.i' % location
,
1089 '%s/_xml.i' % location
,
1090 '%s/_xmlhandler.i' % location
,
1093 ext
= Extension('_xrc',
1096 include_dirs
= includes
,
1097 define_macros
= defines
,
1099 library_dirs
= libdirs
,
1100 libraries
= libs
+ makeLibName('xrc'),
1102 extra_compile_args
= cflags
,
1103 extra_link_args
= lflags
,
1106 wxpExtensions
.append(ext
)
1110 #----------------------------------------------------------------------
1111 # Define the GIZMOS extension module
1112 #----------------------------------------------------------------------
1115 msg('Preparing GIZMOS...')
1116 location
= 'contrib/gizmos'
1118 swig_sources
= run_swig(['gizmos.i'], location
, GENDIR
, PKGDIR
,
1119 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1121 ext
= Extension('_gizmos',
1122 [ '%s/treelistctrl.cpp' % location
] + swig_sources
,
1124 include_dirs
= includes
+ [ location
],
1125 define_macros
= defines
,
1127 library_dirs
= libdirs
,
1128 libraries
= libs
+ makeLibName('gizmos'),
1130 extra_compile_args
= cflags
,
1131 extra_link_args
= lflags
,
1134 wxpExtensions
.append(ext
)
1138 #----------------------------------------------------------------------
1139 # Define the DLLWIDGET extension module
1140 #----------------------------------------------------------------------
1143 msg('Preparing DLLWIDGET...')
1144 location
= 'contrib/dllwidget'
1145 swig_files
= ['dllwidget_.i']
1147 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1148 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1150 # copy a contrib project specific py module to the main package dir
1151 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
1153 ext
= Extension('dllwidget_c', [
1154 '%s/dllwidget.cpp' % location
,
1157 include_dirs
= includes
,
1158 define_macros
= defines
,
1160 library_dirs
= libdirs
,
1163 extra_compile_args
= cflags
,
1164 extra_link_args
= lflags
,
1167 wxpExtensions
.append(ext
)
1172 #----------------------------------------------------------------------
1174 #----------------------------------------------------------------------
1179 SCRIPTS
= [opj('scripts/helpviewer'),
1180 opj('scripts/img2png'),
1181 opj('scripts/img2xpm'),
1182 opj('scripts/img2py'),
1183 opj('scripts/xrced'),
1184 opj('scripts/pyshell'),
1185 opj('scripts/pycrust'),
1186 opj('scripts/pywrap'),
1187 opj('scripts/pywrap'),
1188 opj('scripts/pyalacarte'),
1189 opj('scripts/pyalamode'),
1193 DATA_FILES
+= find_data_files('wx/tools/XRCed', '*.txt', '*.xrc')
1194 DATA_FILES
+= find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html')
1195 DATA_FILES
+= find_data_files('wx', '*.txt', '*.css', '*.html')
1198 #----------------------------------------------------------------------
1199 # Do the Setup/Build/Install/Whatever
1200 #----------------------------------------------------------------------
1202 if __name__
== "__main__":
1204 setup(name
= 'wxPython',
1206 description
= DESCRIPTION
,
1207 long_description
= LONG_DESCRIPTION
,
1209 author_email
= AUTHOR_EMAIL
,
1211 download_url
= DOWNLOAD_URL
,
1213 platforms
= PLATFORMS
,
1214 classifiers
= filter(None, CLASSIFIERS
.split("\n")),
1215 keywords
= KEYWORDS
,
1217 packages
= ['wxPython',
1219 'wxPython.lib.colourchooser',
1220 'wxPython.lib.editor',
1221 'wxPython.lib.mixins',
1226 'wx.lib.colourchooser',
1234 ext_package
= PKGDIR
,
1235 ext_modules
= wxpExtensions
,
1237 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1241 cmdclass
= { 'install_data': smart_install_data}
,
1242 data_files
= DATA_FILES
,
1247 #----------------------------------------------------------------------
1248 #----------------------------------------------------------------------