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
= "p3" # 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
= 0 #(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.
112 # Some MSW build settings
114 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
115 # (0 or 1 only) should probably find a way to
118 HYBRID
= 1 # If set and not debug or FINAL, then build a
119 # hybrid extension that can be used by the
120 # non-debug version of python, but contains
121 # debugging symbols for wxWindows and wxPython.
122 # wxWindows must have been built with /MD, not /MDd
123 # (using FINAL=hybrid will do it.)
125 # Version part of wxWindows LIB/DLL names
126 WXDLLVER
= '%d%d' % (VER_MAJOR
, VER_MINOR
)
129 #----------------------------------------------------------------------
132 if __name__
== "__main__":
137 path
= apply(os
.path
.join
, args
)
138 return os
.path
.normpath(path
)
153 #----------------------------------------------------------------------
155 #----------------------------------------------------------------------
161 force
= '--force' in sys
.argv
or '-f' in sys
.argv
162 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
164 # change the PORT default for wxMac
165 if sys
.platform
[:6] == "darwin":
168 # and do the same for wxMSW, just for consistency
173 #----------------------------------------------------------------------
174 # Check for build flags on the command line
175 #----------------------------------------------------------------------
177 # Boolean (int) flags
178 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
179 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
180 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE',
181 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'BUILD_RENAMERS',
182 'FINAL', 'HYBRID', ]:
183 for x
in range(len(sys
.argv
)):
184 if sys
.argv
[x
].find(flag
) == 0:
185 pos
= sys
.argv
[x
].find('=') + 1
187 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
191 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG']:
192 for x
in range(len(sys
.argv
)):
193 if sys
.argv
[x
].find(option
) == 0:
194 pos
= sys
.argv
[x
].find('=') + 1
196 vars()[option
] = sys
.argv
[x
][pos
:]
199 sys
.argv
= filter(None, sys
.argv
)
202 #----------------------------------------------------------------------
203 # some helper functions
204 #----------------------------------------------------------------------
206 def Verify_WX_CONFIG():
207 """ Called below for the builds that need wx-config,
208 if WX_CONFIG is not set then tries to select the specific
209 wx*-config script based on build options. If not found
210 then it defaults to 'wx-config'.
212 # if WX_CONFIG hasn't been set to an explicit value then construct one.
214 if WX_CONFIG
is None:
215 if debug
: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWindows...
223 ver2
= "%s.%s" % (VER_MAJOR
, VER_MINOR
)
224 WX_CONFIG
= 'wx%s%s%s-%s-config' % (WXPORT
, uf
, df
, ver2
)
226 searchpath
= os
.environ
["PATH"]
227 for p
in searchpath
.split(':'):
228 fp
= os
.path
.join(p
, WX_CONFIG
)
229 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
231 msg("Found wx-config: " + fp
)
235 msg("WX_CONFIG not specified and %s not found on $PATH "
236 "defaulting to \"wx-config\"" % WX_CONFIG
)
237 WX_CONFIG
= 'wx-config'
241 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
242 """Run SWIG the way I want it done"""
244 if not os
.path
.exists(os
.path
.join(dir, gendir
)):
245 os
.mkdir(os
.path
.join(dir, gendir
))
250 basefile
= os
.path
.splitext(file)[0]
251 i_file
= os
.path
.join(dir, file)
252 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
253 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'_wrap.cpp')
255 sources
.append(cpp_file
)
258 for dep
in swig_deps
:
259 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
263 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
264 ## we need forward slashes here even on win32
265 #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\'))
266 #i_file = opj(i_file) #'/'.join(i_file.split('\\'))
269 # first run build_renamers
270 cmd
= [ sys
.executable
, '-u',
271 './distrib/build_renamers.py',
272 i_file
, '-D'+WXPLAT
, ] + \
273 [x
for x
in swig_args
if x
.startswith('-I')]
277 # Then run swig for real
278 cmd
= [ swig_cmd
] + swig_args
+ ['-I'+dir, '-o', cpp_file
, i_file
]
283 # copy the generated python file to the package directory
284 copy_file(py_file
, package
, update
=not force
, verbose
=0)
290 def contrib_copy_tree(src
, dest
, verbose
=0):
291 """Update local copies of wxWindows contrib files"""
292 from distutils
.dir_util
import mkpath
, copy_tree
294 mkpath(dest
, verbose
=verbose
)
295 copy_tree(src
, dest
, update
=1, verbose
=verbose
)
299 class smart_install_data(install_data
):
301 #need to change self.install_dir to the actual library dir
302 install_cmd
= self
.get_finalized_command('install')
303 self
.install_dir
= getattr(install_cmd
, 'install_lib')
304 return install_data
.run(self
)
307 def build_locale_dir(destdir
, verbose
=1):
308 """Build a locale dir under the wxPython package for MSW"""
309 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
311 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
312 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
313 mkpath(dest
, verbose
=verbose
)
314 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
317 def build_locale_list(srcdir
):
318 # get a list of all files under the srcdir, to be used for install_data
319 def walk_helper(lst
, dirname
, files
):
321 filename
= opj(dirname
, f
)
322 if not os
.path
.isdir(filename
):
323 lst
.append( (dirname
, [filename
]) )
325 os
.path
.walk(srcdir
, walk_helper
, file_list
)
329 def find_data_files(srcdir
, *wildcards
):
330 # get a list of all files under the srcdir matching wildcards,
331 # returned in a format to be used for install_data
333 def walk_helper(arg
, dirname
, files
):
338 filename
= opj(dirname
, f
)
339 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
):
340 names
.append(filename
)
342 lst
.append( (dirname
, names
) )
345 os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
))
349 def makeLibName(name
):
350 if os
.name
== 'posix':
351 libname
= '%s_%s-%s' % (WXBASENAME
, name
, WXRELEASE
)
353 libname
= 'wxmsw%s%s_%s' % (WXDLLVER
, libFlag(), name
)
359 def adjustCFLAGS(cflags
, defines
, includes
):
360 '''Extrace the raw -I, -D, and -U flags and put them into
361 defines and includes as needed.'''
365 includes
.append(flag
[2:])
366 elif flag
[:2] == '-D':
368 if flag
.find('=') == -1:
369 defines
.append( (flag
, None) )
371 defines
.append( tuple(flag
.split('=')) )
372 elif flag
[:2] == '-U':
373 defines
.append( (flag
[2:], ) )
375 newCFLAGS
.append(flag
)
380 def adjustLFLAGS(lfags
, libdirs
, libs
):
381 '''Extrace the -L and -l flags and put them in libdirs and libs as needed'''
385 libdirs
.append(flag
[2:])
386 elif flag
[:2] == '-l':
387 libs
.append(flag
[2:])
389 newLFLAGS
.append(flag
)
393 #----------------------------------------------------------------------
412 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
413 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
416 #----------------------------------------------------------------------
417 # Setup some platform specific stuff
418 #----------------------------------------------------------------------
421 # Set compile flags and such for MSVC. These values are derived
422 # from the wxWindows makefiles for MSVC, other compilers settings
423 # will probably vary...
424 if os
.environ
.has_key('WXWIN'):
425 WXDIR
= os
.environ
['WXWIN']
427 msg("WARNING: WXWIN not set in environment.")
428 WXDIR
= '..' # assumes in CVS tree
432 includes
= ['include', 'src',
433 opj(WXDIR
, 'lib', 'vc_dll', 'msw' + libFlag()),
434 opj(WXDIR
, 'include'),
435 opj(WXDIR
, 'contrib', 'include'),
438 defines
= [ ('WIN32', None),
444 ('SWIG_GLOBAL', None),
445 ('WXP_USE_THREAD', '1'),
449 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
452 if not FINAL
or HYBRID
:
453 defines
.append( ('__WXDEBUG__', None) )
455 libdirs
= [ opj(WXDIR
, 'lib', 'vc_dll') ]
456 libs
= [ 'wxbase' + WXDLLVER
+ libFlag(), # TODO: trim this down to what is really needed for the core
457 'wxbase' + WXDLLVER
+ libFlag() + '_net',
458 'wxbase' + WXDLLVER
+ libFlag() + '_xml',
459 makeLibName('core')[0],
460 makeLibName('adv')[0],
461 makeLibName('html')[0],
464 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
465 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
466 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
467 'advapi32', 'wsock32']
471 # '/GX-' # workaround for internal compiler error in MSVC on some machines
475 # Other MSVC flags...
476 # Too bad I don't remember why I was playing with these, can they be removed?
478 pass #cflags = cflags + ['/O1']
480 pass #cflags = cflags + ['/Ox']
482 pass # cflags = cflags + ['/Od', '/Z7']
483 # lflags = ['/DEBUG', ]
487 #----------------------------------------------------------------------
489 elif os
.name
== 'posix':
491 includes
= ['include', 'src']
492 defines
= [('SWIG_GLOBAL', None),
493 ('HAVE_CONFIG_H', None),
494 ('WXP_USE_THREAD', '1'),
497 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
504 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
505 cflags
= cflags
.split()
512 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
513 lflags
= lflags
.split()
515 WXBASENAME
= os
.popen(WX_CONFIG
+ ' --basename').read()[:-1]
516 WXRELEASE
= os
.popen(WX_CONFIG
+ ' --release').read()[:-1]
517 WXPREFIX
= os
.popen(WX_CONFIG
+ ' --prefix').read()[:-1]
520 if sys
.platform
[:6] == "darwin":
521 # Flags and such for a Darwin (Max OS X) build of Python
529 # Set flags for other Unix type platforms
534 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
535 elif WXPORT
== 'gtk2':
537 GENDIR
= 'gtk' # no code differences so use the same generated sources
538 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
539 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
540 elif WXPORT
== 'x11':
543 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
545 raise SystemExit, "Unknown WXPORT value: " + WXPORT
547 cflags
+= portcfg
.split()
549 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
550 # wx-config doesn't output that for some reason. For now, just
551 # add it unconditionally but we should really check if the lib is
552 # really found there or wx-config should be fixed.
553 libdirs
.append("/usr/X11R6/lib")
556 # Move the various -I, -D, etc. flags we got from the *config scripts
557 # into the distutils lists.
558 cflags
= adjustCFLAGS(cflags
, defines
, includes
)
559 lflags
= adjustLFLAGS(lflags
, libdirs
, libs
)
562 #----------------------------------------------------------------------
564 raise 'Sorry Charlie, platform not supported...'
567 #----------------------------------------------------------------------
568 # post platform setup checks and tweaks, create the full version string
569 #----------------------------------------------------------------------
572 BUILD_BASE
= BUILD_BASE
+ '.unicode'
576 VERSION
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
,
577 VER_SUBREL
, VER_FLAGS
)
579 #----------------------------------------------------------------------
580 # Update the version file
581 #----------------------------------------------------------------------
583 # Unconditionally updated since the version string can change based
584 # on the UNICODE flag
585 open('src/__version__.py', 'w').write("""\
586 # This file was generated by setup.py...
588 VERSION_STRING = '%(VERSION)s'
589 MAJOR_VERSION = %(VER_MAJOR)s
590 MINOR_VERSION = %(VER_MINOR)s
591 RELEASE_VERSION = %(VER_RELEASE)s
592 SUBREL_VERSION = %(VER_SUBREL)s
594 VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION,
595 SUBREL_VERSION, '%(VER_FLAGS)s')
597 RELEASE_NUMBER = RELEASE_VERSION # for compatibility
603 #----------------------------------------------------------------------
605 #----------------------------------------------------------------------
625 swig_args
.append('-DwxUSE_UNICODE')
627 swig_deps
= [ 'src/my_typemaps.i',
632 depends
= [ #'include/wx/wxPython/wxPython.h',
633 #'include/wx/wxPython/wxPython_int.h',
638 #----------------------------------------------------------------------
639 # Define the CORE extension module
640 #----------------------------------------------------------------------
642 msg('Preparing CORE...')
643 swig_sources
= run_swig(['core.i'], 'src', GENDIR
, PKGDIR
,
644 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
647 'src/_constraints.i',
650 'src/_core_rename.i',
651 'src/_core_reverse.txt',
668 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
669 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0)
672 # update the license files
674 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
675 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
679 build_locale_dir(opj(PKGDIR
, 'locale'))
680 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
684 rc_file
= ['src/wxc.rc']
689 ext
= Extension('_core', ['src/helpers.cpp',
691 ] + rc_file
+ swig_sources
,
693 include_dirs
= includes
,
694 define_macros
= defines
,
696 library_dirs
= libdirs
,
699 extra_compile_args
= cflags
,
700 extra_link_args
= lflags
,
704 wxpExtensions
.append(ext
)
710 # Extension for the GDI module
711 swig_sources
= run_swig(['gdi.i'], 'src', GENDIR
, PKGDIR
,
712 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
713 ['src/_gdi_rename.i',
714 'src/_bitmap.i', 'src/_brush.i',
715 'src/_colour.i', 'src/_cursor.i',
716 'src/_dc.i', 'src/_font.i',
717 'src/_gdiobj.i', 'src/_icon.i',
718 'src/_imaglist.i', 'src/_pen.i',
719 'src/_region.i', 'src/_palette.i',
720 'src/_stockobjs.i', 'src/_dragimg.i',
725 ext
= Extension('_gdi', ['src/drawlist.cpp'] + swig_sources
,
726 include_dirs
= includes
,
727 define_macros
= defines
,
728 library_dirs
= libdirs
,
730 extra_compile_args
= cflags
,
731 extra_link_args
= lflags
,
734 wxpExtensions
.append(ext
)
741 # Extension for the windows module
742 swig_sources
= run_swig(['windows.i'], 'src', GENDIR
, PKGDIR
,
743 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
744 ['src/_windows_rename.i', 'src/_windows_reverse.txt',
747 'src/_toplvl.i', 'src/_statusbar.i',
748 'src/_splitter.i', 'src/_sashwin.i',
749 'src/_popupwin.i', 'src/_tipwin.i',
750 'src/_vscroll.i', 'src/_taskbar.i',
751 'src/_cmndlgs.i', 'src/_mdi.i',
752 'src/_pywindows.i', 'src/_printfw.i',
754 ext
= Extension('_windows', swig_sources
,
755 include_dirs
= includes
,
756 define_macros
= defines
,
757 library_dirs
= libdirs
,
759 extra_compile_args
= cflags
,
760 extra_link_args
= lflags
,
763 wxpExtensions
.append(ext
)
768 # Extension for the controls module
769 swig_sources
= run_swig(['controls.i'], 'src', GENDIR
, PKGDIR
,
770 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
771 [ 'src/_controls_rename.i', 'src/_controls_reverse.txt',
772 'src/_control.i', 'src/_toolbar.i',
773 'src/_button.i', 'src/_checkbox.i',
774 'src/_choice.i', 'src/_combobox.i',
775 'src/_gauge.i', 'src/_statctrls.i',
776 'src/_listbox.i', 'src/_textctrl.i',
777 'src/_scrolbar.i', 'src/_spin.i',
778 'src/_radio.i', 'src/_slider.i',
779 'src/_tglbtn.i', 'src/_notebook.i',
780 'src/_listctrl.i', 'src/_treectrl.i',
781 'src/_dirctrl.i', 'src/_pycontrol.i',
784 ext
= Extension('_controls', swig_sources
,
785 include_dirs
= includes
,
786 define_macros
= defines
,
787 library_dirs
= libdirs
,
789 extra_compile_args
= cflags
,
790 extra_link_args
= lflags
,
793 wxpExtensions
.append(ext
)
798 # Extension for the misc module
799 swig_sources
= run_swig(['misc.i'], 'src', GENDIR
, PKGDIR
,
800 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
801 [ 'src/_settings.i', 'src/_functions.i',
802 'src/_misc.i', 'src/_tipdlg.i',
803 'src/_timer.i', 'src/_log.i',
804 'src/_process.i', 'src/_joystick.i',
805 'src/_wave.i', 'src/_mimetype.i',
806 'src/_artprov.i', 'src/_config.i',
807 'src/_datetime.i', 'src/_dataobj.i',
811 ext
= Extension('_misc', swig_sources
,
812 include_dirs
= includes
,
813 define_macros
= defines
,
814 library_dirs
= libdirs
,
816 extra_compile_args
= cflags
,
817 extra_link_args
= lflags
,
820 wxpExtensions
.append(ext
)
825 ## Core modules that are not in the "core" namespace start here
828 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
829 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
830 ext
= Extension('_calendar', swig_sources
,
831 include_dirs
= includes
,
832 define_macros
= defines
,
833 library_dirs
= libdirs
,
835 extra_compile_args
= cflags
,
836 extra_link_args
= lflags
,
839 wxpExtensions
.append(ext
)
842 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
843 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
844 ext
= Extension('_grid', 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
)
857 swig_sources
= run_swig(['html.i'], 'src', GENDIR
, PKGDIR
,
858 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
859 ext
= Extension('_html', swig_sources
,
860 include_dirs
= includes
,
861 define_macros
= defines
,
862 library_dirs
= libdirs
,
864 extra_compile_args
= cflags
,
865 extra_link_args
= lflags
,
868 wxpExtensions
.append(ext
)
872 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
873 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
874 ext
= Extension('_wizard', swig_sources
,
875 include_dirs
= includes
,
876 define_macros
= defines
,
877 library_dirs
= libdirs
,
879 extra_compile_args
= cflags
,
880 extra_link_args
= lflags
,
883 wxpExtensions
.append(ext
)
889 #----------------------------------------------------------------------
890 # Define the GLCanvas extension module
891 #----------------------------------------------------------------------
894 msg('Preparing GLCANVAS...')
895 location
= 'contrib/glcanvas'
897 swig_sources
= run_swig(['glcanvas.i'], location
, GENDIR
, PKGDIR
,
898 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
901 if os
.name
== 'posix':
902 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
903 gl_lflags
= gl_config
.split() + lflags
906 gl_libs
= libs
+ ['opengl32', 'glu32'] + makeLibName('gl')
909 ext
= Extension('_glcanvas',
912 include_dirs
= includes
,
913 define_macros
= defines
,
915 library_dirs
= libdirs
,
918 extra_compile_args
= cflags
,
919 extra_link_args
= gl_lflags
,
922 wxpExtensions
.append(ext
)
925 #----------------------------------------------------------------------
926 # Define the OGL extension module
927 #----------------------------------------------------------------------
930 msg('Preparing OGL...')
931 location
= 'contrib/ogl'
933 swig_sources
= run_swig(['ogl.i'], location
, '', PKGDIR
,
934 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
935 [ '%s/_oglbasic.i' % location
,
936 '%s/_oglshapes.i' % location
,
937 '%s/_oglshapes2.i' % location
,
938 '%s/_oglcanvas.i' % location
,
939 '%s/_ogldefs.i' % location
,
942 ext
= Extension('_ogl',
945 include_dirs
= includes
,
946 define_macros
= defines
+ [('wxUSE_DEPRECATED', '0')],
948 library_dirs
= libdirs
,
949 libraries
= libs
+ makeLibName('ogl'),
951 extra_compile_args
= cflags
,
952 extra_link_args
= lflags
,
955 wxpExtensions
.append(ext
)
959 #----------------------------------------------------------------------
960 # Define the STC extension module
961 #----------------------------------------------------------------------
964 msg('Preparing STC...')
965 location
= 'contrib/stc'
967 STC_H
= opj(WXDIR
, 'contrib', 'include/wx/stc')
969 STC_H
= opj(WXPREFIX
, 'include/wx/stc')
971 ## NOTE: need to add this to the stc.bkl...
973 ## # Check if gen_iface needs to be run for the wxSTC sources
974 ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
975 ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
976 ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
978 ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
980 ## os.chdir(opj(CTRB_SRC, 'stc'))
981 ## sys.path.insert(0, os.curdir)
983 ## gen_iface.main([])
987 swig_sources
= run_swig(['stc.i'], location
, '', PKGDIR
,
988 USE_SWIG
, swig_force
,
989 swig_args
+ ['-I'+STC_H
, '-I'+location
],
990 [opj(STC_H
, 'stc.h')] + swig_deps
)
992 ext
= Extension('_stc',
995 include_dirs
= includes
,
996 define_macros
= defines
,
998 library_dirs
= libdirs
,
999 libraries
= libs
+ makeLibName('stc'),
1001 extra_compile_args
= cflags
,
1002 extra_link_args
= lflags
,
1005 wxpExtensions
.append(ext
)
1009 #----------------------------------------------------------------------
1010 # Define the IEWIN extension module (experimental)
1011 #----------------------------------------------------------------------
1014 msg('Preparing IEWIN...')
1015 location
= 'contrib/iewin'
1017 swig_files
= ['iewin.i', ]
1019 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1020 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1023 ext
= Extension('iewinc', ['%s/IEHtmlWin.cpp' % location
,
1024 '%s/wxactivex.cpp' % location
,
1027 include_dirs
= includes
,
1028 define_macros
= defines
,
1030 library_dirs
= libdirs
,
1033 extra_compile_args
= cflags
,
1034 extra_link_args
= lflags
,
1037 wxpExtensions
.append(ext
)
1040 #----------------------------------------------------------------------
1041 # Define the XRC extension module
1042 #----------------------------------------------------------------------
1045 msg('Preparing XRC...')
1046 location
= 'contrib/xrc'
1048 swig_sources
= run_swig(['xrc.i'], location
, '', PKGDIR
,
1049 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
1050 [ '%s/_xrc_rename.i' % location
,
1051 '%s/_xrc_ex.py' % location
,
1052 '%s/_xmlres.i' % location
,
1053 '%s/_xmlsub.i' % location
,
1054 '%s/_xml.i' % location
,
1055 '%s/_xmlhandler.i' % location
,
1058 ext
= Extension('_xrc',
1061 include_dirs
= includes
,
1062 define_macros
= defines
,
1064 library_dirs
= libdirs
,
1065 libraries
= libs
+ makeLibName('xrc'),
1067 extra_compile_args
= cflags
,
1068 extra_link_args
= lflags
,
1071 wxpExtensions
.append(ext
)
1075 #----------------------------------------------------------------------
1076 # Define the GIZMOS extension module
1077 #----------------------------------------------------------------------
1080 msg('Preparing GIZMOS...')
1081 location
= 'contrib/gizmos'
1083 swig_sources
= run_swig(['gizmos.i'], location
, '', PKGDIR
,
1084 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1086 ext
= Extension('_gizmos',
1087 [ '%s/treelistctrl.cpp' % location
] + swig_sources
,
1089 include_dirs
= includes
,
1090 define_macros
= defines
,
1092 library_dirs
= libdirs
,
1093 libraries
= libs
+ makeLibName('gizmos'),
1095 extra_compile_args
= cflags
,
1096 extra_link_args
= lflags
,
1099 wxpExtensions
.append(ext
)
1103 #----------------------------------------------------------------------
1104 # Define the DLLWIDGET extension module
1105 #----------------------------------------------------------------------
1108 msg('Preparing DLLWIDGET...')
1109 location
= 'contrib/dllwidget'
1110 swig_files
= ['dllwidget_.i']
1112 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1113 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1115 # copy a contrib project specific py module to the main package dir
1116 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
1118 ext
= Extension('dllwidget_c', [
1119 '%s/dllwidget.cpp' % location
,
1122 include_dirs
= includes
,
1123 define_macros
= defines
,
1125 library_dirs
= libdirs
,
1128 extra_compile_args
= cflags
,
1129 extra_link_args
= lflags
,
1132 wxpExtensions
.append(ext
)
1137 #----------------------------------------------------------------------
1139 #----------------------------------------------------------------------
1144 SCRIPTS
= [opj('scripts/helpviewer'),
1145 opj('scripts/img2png'),
1146 opj('scripts/img2xpm'),
1147 opj('scripts/img2py'),
1148 opj('scripts/xrced'),
1149 opj('scripts/pyshell'),
1150 opj('scripts/pycrust'),
1151 opj('scripts/pywrap'),
1152 opj('scripts/pywrap'),
1153 opj('scripts/pyalacarte'),
1154 opj('scripts/pyalamode'),
1158 DATA_FILES
+= find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc')
1159 DATA_FILES
+= find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html')
1160 DATA_FILES
+= find_data_files('wx', '*.txt', '*.css', '*.html')
1163 #----------------------------------------------------------------------
1164 # Do the Setup/Build/Install/Whatever
1165 #----------------------------------------------------------------------
1167 if __name__
== "__main__":
1169 setup(name
= 'wxPython',
1171 description
= DESCRIPTION
,
1172 long_description
= LONG_DESCRIPTION
,
1174 author_email
= AUTHOR_EMAIL
,
1176 download_url
= DOWNLOAD_URL
,
1178 platforms
= PLATFORMS
,
1179 classifiers
= filter(None, CLASSIFIERS
.split("\n")),
1180 keywords
= KEYWORDS
,
1182 packages
= ['wxPython',
1184 'wxPython.lib.colourchooser',
1185 'wxPython.lib.editor',
1186 'wxPython.lib.mixins',
1191 'wx.lib.colourchooser',
1200 ext_package
= PKGDIR
,
1201 ext_modules
= wxpExtensions
,
1203 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1207 cmdclass
= { 'install_data': smart_install_data}
,
1208 data_files
= DATA_FILES
,
1213 #----------------------------------------------------------------------
1214 #----------------------------------------------------------------------