2 #---------------------------------------------------------------------- 
   4 import sys
, os
, glob
, fnmatch
 
   5 from distutils
.core      
import setup
, Extension
 
   6 from distutils
.file_util 
import copy_file
 
   7 from distutils
.dir_util  
import mkpath
 
   8 from distutils
.dep_util  
import newer
 
   9 from distutils
.spawn     
import spawn
 
  10 from distutils
.command
.install_data 
import install_data
 
  12 #---------------------------------------------------------------------- 
  13 # flags and values that affect this script 
  14 #---------------------------------------------------------------------- 
  16 VER_MAJOR        
= 2      # The first three must match wxWindows 
  19 VER_SUBREL       
= 0      # wxPython release num for x.y.z release of wxWindows 
  20 VER_FLAGS        
= "p1"   # release flags, such as prerelease num, unicode, etc. 
  22 DESCRIPTION      
= "Cross platform GUI toolkit for Python" 
  24 AUTHOR_EMAIL     
= "Robin Dunn <robin@alldunn.com>" 
  25 URL              
= "http://wxPython.org/" 
  26 LICENSE          
= "wxWindows (LGPL derivative)" 
  27 LONG_DESCRIPTION 
= """\ 
  28 wxPython is a GUI toolkit for Python that is a wrapper around the 
  29 wxWindows C++ GUI library.  wxPython provides a large variety of 
  30 window types and controls, all implemented with a native look and 
  31 feel (by using the native widgets) on the platforms it is supported 
  36 # Config values below this point can be reset on the setup.py command line. 
  38 BUILD_GLCANVAS 
= 1 # If true, build the contrib/glcanvas extension module 
  39 BUILD_OGL 
= 1      # If true, build the contrib/ogl extension module 
  40 BUILD_STC 
= 1      # If true, build the contrib/stc extension module 
  41 BUILD_XRC 
= 1      # XML based resource system 
  42 BUILD_GIZMOS 
= 1   # Build a module for the gizmos contrib library 
  43 BUILD_DLLWIDGET 
= 0# Build a module that enables unknown wx widgets 
  44                    # to be loaded from a DLL and to be used from Python. 
  46                    # Internet Explorer wrapper (experimental) 
  47 BUILD_IEWIN 
= (os
.name 
== 'nt') 
  50 CORE_ONLY 
= 0      # if true, don't build any of the above 
  52 PREP_ONLY 
= 0      # Only run the prepatory steps, not the actual build. 
  54 USE_SWIG 
= 0       # Should we actually execute SWIG, or just use the 
  55                    # files already in the distribution? 
  57 UNICODE 
= 0        # This will pass the 'wxUSE_UNICODE' flag to SWIG and 
  58                    # will ensure that the right headers are found and the 
  59                    # right libs are linked. 
  61 IN_CVS_TREE 
= 1    # Set to true if building in a full wxWindows CVS 
  62                    # tree, or the new style of a full wxPythonSrc tarball. 
  63                    # wxPython used to be distributed as a separate source 
  64                    # tarball without the wxWindows but with a copy of the 
  65                    # needed contrib code.  That's no longer the case and so 
  66                    # this setting is now defaulting to true.  Eventually it 
  67                    # should be removed entirly. 
  69 UNDEF_NDEBUG 
= 1   # Python 2.2 on Unix/Linux by default defines NDEBUG, 
  70                    # and distutils will pick this up and use it on the 
  71                    # compile command-line for the extensions.  This could 
  72                    # conflict with how wxWindows was built.  If NDEBUG is 
  73                    # set then wxWindows' __WXDEBUG__ setting will be turned 
  74                    # off.  If wxWindows was actually built with it turned 
  75                    # on then you end up with mismatched class structures, 
  76                    # and wxPython will crash. 
  78 NO_SCRIPTS 
= 0     # Don't install the tool scripts 
  80 WX_CONFIG 
= None   # Usually you shouldn't need to touch this, but you can set 
  81                    # it to pass an alternate version of wx-config or alternate 
  82                    # flags, eg. as required by the .deb in-tree build.  By 
  83                    # default a wx-config command will be assembled based on 
  84                    # version, port, etc. and it will be looked for on the 
  87 WXPORT 
= 'gtk'     # On Linux/Unix there are several ports of wxWindows available. 
  88                    # Setting this value lets you select which will be used for 
  89                    # the wxPython build.  Possibilites are 'gtk', 'gtk2' and 
  90                    # 'x11'.  Curently only gtk and gtk2 works. 
  92 BUILD_BASE 
= "build"       # Directory to use for temporary build files. 
  96 # Some MSW build settings 
  98 FINAL 
= 0          # Mirrors use of same flag in wx makefiles, 
  99                    # (0 or 1 only) should probably find a way to 
 102 HYBRID 
= 1         # If set and not debug or FINAL, then build a 
 103                    # hybrid extension that can be used by the 
 104                    # non-debug version of python, but contains 
 105                    # debugging symbols for wxWindows and wxPython. 
 106                    # wxWindows must have been built with /MD, not /MDd 
 107                    # (using FINAL=hybrid will do it.) 
 109 WXDLLVER 
= '250'   # Version part of wxWindows DLL name 
 112 #---------------------------------------------------------------------- 
 115     if __name__ 
== "__main__": 
 120     path 
= apply(os
.path
.join
, args
) 
 121     return os
.path
.normpath(path
) 
 136 #---------------------------------------------------------------------- 
 138 #---------------------------------------------------------------------- 
 144 force 
= '--force' in sys
.argv 
or '-f' in sys
.argv
 
 145 debug 
= '--debug' in sys
.argv 
or '-g' in sys
.argv
 
 147 # change the PORT default for wxMac 
 148 if sys
.platform
[:6] == "darwin": 
 151 # and do the same for wxMSW, just for consistency 
 156 #---------------------------------------------------------------------- 
 157 # Check for build flags on the command line 
 158 #---------------------------------------------------------------------- 
 160 # Boolean (int) flags 
 161 for flag 
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC', 
 162              'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', 
 163              'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE', 
 164              'UNDEF_NDEBUG', 'NO_SCRIPTS', 
 165              'FINAL', 'HYBRID', ]: 
 166     for x 
in range(len(sys
.argv
)): 
 167         if sys
.argv
[x
].find(flag
) == 0: 
 168             pos 
= sys
.argv
[x
].find('=') + 1 
 170                 vars()[flag
] = eval(sys
.argv
[x
][pos
:]) 
 174 for option 
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']: 
 175     for x 
in range(len(sys
.argv
)): 
 176         if sys
.argv
[x
].find(option
) == 0: 
 177             pos 
= sys
.argv
[x
].find('=') + 1 
 179                 vars()[option
] = sys
.argv
[x
][pos
:] 
 182 sys
.argv 
= filter(None, sys
.argv
) 
 185 #---------------------------------------------------------------------- 
 186 # some helper functions 
 187 #---------------------------------------------------------------------- 
 189 def Verify_WX_CONFIG(): 
 190     """ Called below for the builds that need wx-config, 
 191         if WX_CONFIG is not set then tries to select the specific 
 192         wx*-config script based on build options.  If not found 
 193         then it defaults to 'wx-config'. 
 195     # if WX_CONFIG hasn't been set to an explicit value then construct one. 
 197     if WX_CONFIG 
is None: 
 198         if debug
:             # TODO: Fix this.  wxPython's --debug shouldn't be tied to wxWindows... 
 206         ver2 
= "%s.%s" % (VER_MAJOR
, VER_MINOR
) 
 207         WX_CONFIG 
= 'wx%s%s%s-%s-config' % (WXPORT
, uf
, df
, ver2
) 
 209         searchpath 
= os
.environ
["PATH"] 
 210         for p 
in searchpath
.split(':'): 
 211             fp 
= os
.path
.join(p
, WX_CONFIG
) 
 212             if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
): 
 214                 msg("Found wx-config: " + fp
) 
 218             msg("WX_CONFIG not specified and %s not found on $PATH " 
 219                   "defaulting to \"wx-config\"" % WX_CONFIG
) 
 220             WX_CONFIG 
= 'wx-config' 
 224 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]): 
 225     """Run SWIG the way I want it done""" 
 226     if not os
.path
.exists(os
.path
.join(dir, gendir
)): 
 227         os
.mkdir(os
.path
.join(dir, gendir
)) 
 232         basefile 
= os
.path
.splitext(file)[0] 
 233         i_file   
= os
.path
.join(dir, file) 
 234         py_file  
= os
.path
.join(dir, gendir
, basefile
+'.py') 
 235         cpp_file 
= os
.path
.join(dir, gendir
, basefile
+'.cpp') 
 237         sources
.append(cpp_file
) 
 240             for dep 
in swig_deps
: 
 241                 if newer(dep
, py_file
) or newer(dep
, cpp_file
): 
 245             if force 
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
): 
 246                 # we need forward slashes here even on win32 
 247                 cpp_file 
= '/'.join(cpp_file
.split('\\')) 
 248                 i_file 
= '/'.join(i_file
.split('\\')) 
 250                 cmd 
= ['./wxSWIG/wxswig'] + swig_args 
+ ['-I'+dir, '-c', '-o', cpp_file
, i_file
] 
 254         # copy the generated python file to the package directory 
 255         copy_file(py_file
, package
, update
=not force
, verbose
=0) 
 261 def contrib_copy_tree(src
, dest
, verbose
=0): 
 262     """Update local copies of wxWindows contrib files""" 
 263     from distutils
.dir_util 
import mkpath
, copy_tree
 
 265     mkpath(dest
, verbose
=verbose
) 
 266     copy_tree(src
, dest
, update
=1, verbose
=verbose
) 
 270 class smart_install_data(install_data
): 
 272         #need to change self.install_dir to the actual library dir 
 273         install_cmd 
= self
.get_finalized_command('install') 
 274         self
.install_dir 
= getattr(install_cmd
, 'install_lib') 
 275         return install_data
.run(self
) 
 278 def build_locale_dir(destdir
, verbose
=1): 
 279     """Build a locale dir under the wxPython package for MSW""" 
 280     moFiles 
= glob
.glob(opj(WXDIR
, 'locale', '*.mo')) 
 282         lang 
= os
.path
.splitext(os
.path
.basename(src
))[0] 
 283         dest 
= opj(destdir
, lang
, 'LC_MESSAGES') 
 284         mkpath(dest
, verbose
=verbose
) 
 285         copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
) 
 288 def build_locale_list(srcdir
): 
 289     # get a list of all files under the srcdir, to be used for install_data 
 290     def walk_helper(lst
, dirname
, files
): 
 292             filename 
= opj(dirname
, f
) 
 293             if not os
.path
.isdir(filename
): 
 294                 lst
.append( (dirname
, [filename
]) ) 
 296     os
.path
.walk(srcdir
, walk_helper
, file_list
) 
 300 def find_data_files(srcdir
, *wildcards
): 
 301     # get a list of all files under the srcdir matching wildcards, 
 302     # returned in a format to be used for install_data 
 304     def walk_helper(arg
, dirname
, files
): 
 309                 filename 
= opj(dirname
, f
) 
 310                 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
): 
 311                     names
.append(filename
) 
 313             lst
.append( (dirname
, names 
) ) 
 316     os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
)) 
 320 def makeLibName(name
): 
 321     if os
.name 
== 'posix': 
 322         libname 
= '%s_%s-%s' % (WXBASENAME
, name
, WXRELEASE
) 
 324         raise NotImplementedError 
 330 def adjustCFLAGS(cflags
, defines
, includes
): 
 331     '''Extrace the raw -I, -D, and -U flags and put them into 
 332        defines and includes as needed.''' 
 336             includes
.append(flag
[2:]) 
 337         elif flag
[:2] == '-D': 
 339             if flag
.find('=') == -1: 
 340                 defines
.append( (flag
, None) ) 
 342                 defines
.append( tuple(flag
.split('=')) ) 
 343         elif flag
[:2] == '-U': 
 344             defines
.append( (flag
[2:], ) ) 
 346             newCFLAGS
.append(flag
) 
 351 def adjustLFLAGS(lfags
, libdirs
, libs
): 
 352     '''Extrace the -L and -l flags and put them in libdirs and libs as needed''' 
 356             libdirs
.append(flag
[2:]) 
 357         elif flag
[:2] == '-l': 
 358             libs
.append(flag
[2:]) 
 360             newLFLAGS
.append(flag
) 
 364 #---------------------------------------------------------------------- 
 383 if UNICODE 
and WXPORT 
not in ['msw', 'gtk2']: 
 384     raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
 
 387 #---------------------------------------------------------------------- 
 388 # Setup some platform specific stuff 
 389 #---------------------------------------------------------------------- 
 392     # Set compile flags and such for MSVC.  These values are derived 
 393     # from the wxWindows makefiles for MSVC, other compilers settings 
 394     # will probably vary... 
 395     if os
.environ
.has_key('WXWIN'): 
 396         WXDIR 
= os
.environ
['WXWIN'] 
 398         msg("WARNING: WXWIN not set in environment.") 
 399         WXDIR 
= '..'  # assumes in CVS tree 
 404                 opj(WXDIR
, 'lib', 'mswdll' + libFlag()), 
 405                 opj(WXDIR
, 'include'), 
 408     defines 
= [ ('WIN32', None), 
 411                 ('__WINDOWS__', None), 
 412                 ('WINVER', '0x0400'), 
 419                 ('SWIG_GLOBAL', None), 
 420                 ('HAVE_CONFIG_H', None), 
 421                 ('WXP_USE_THREAD', '1'), 
 425         defines
.append( ('NDEBUG',) )  # using a 1-tuple makes it do an undef 
 428     if not FINAL 
or HYBRID
: 
 429         defines
.append( ('__WXDEBUG__', None) ) 
 431     libdirs 
= [ opj(WXDIR
, 'lib') ] 
 432     wxdll 
= 'wxmsw' + WXDLLVER 
+ libFlag() 
 435     libs 
= libs 
+ ['kernel32', 'user32', 'gdi32', 'comdlg32', 
 436             'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', 
 437             'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4', 
 438             'advapi32', 'wsock32'] 
 442              # '/GX-'  # workaround for internal compiler error in MSVC on some machines 
 446     # Other MSVC flags... 
 447     # Too bad I don't remember why I was playing with these, can they be removed? 
 449         pass #cflags = cflags + ['/O1'] 
 451         pass #cflags = cflags + ['/Ox'] 
 453         pass # cflags = cflags + ['/Od', '/Z7'] 
 454              # lflags = ['/DEBUG', ] 
 458 #---------------------------------------------------------------------- 
 460 elif os
.name 
== 'posix': 
 461     WXDIR 
= '..'              # assumes IN_CVS_TREE 
 463     defines 
= [('SWIG_GLOBAL', None), 
 464                ('HAVE_CONFIG_H', None), 
 465                ('WXP_USE_THREAD', '1'), 
 468         defines
.append( ('NDEBUG',) )  # using a 1-tuple makes it do an undef 
 475     cflags 
= os
.popen(WX_CONFIG 
+ ' --cxxflags', 'r').read()[:-1] 
 476     cflags 
= cflags
.split() 
 481     lflags 
= os
.popen(WX_CONFIG 
+ ' --libs', 'r').read()[:-1] 
 482     lflags 
= lflags
.split() 
 484     WXBASENAME 
= os
.popen(WX_CONFIG 
+ ' --basename').read()[:-1] 
 485     WXRELEASE  
= os
.popen(WX_CONFIG 
+ ' --release').read()[:-1] 
 486     WXPREFIX   
= os
.popen(WX_CONFIG 
+ ' --prefix').read()[:-1] 
 489     if sys
.platform
[:6] == "darwin": 
 490         # Flags and such for a Darwin (Max OS X) build of Python 
 498         # Set flags for other Unix type platforms 
 503             portcfg 
= os
.popen('gtk-config --cflags', 'r').read()[:-1] 
 504         elif WXPORT 
== 'gtk2': 
 506             GENDIR 
= 'gtk' # no code differences so use the same generated sources 
 507             portcfg 
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1] 
 508             BUILD_BASE 
= BUILD_BASE 
+ '-' + WXPORT
 
 509         elif WXPORT 
== 'x11': 
 512             BUILD_BASE 
= BUILD_BASE 
+ '-' + WXPORT
 
 514             raise SystemExit, "Unknown WXPORT value: " + WXPORT
 
 516         cflags 
+= portcfg
.split() 
 518         # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but 
 519         # wx-config doesn't output that for some reason.  For now, just 
 520         # add it unconditionally but we should really check if the lib is 
 521         # really found there or wx-config should be fixed. 
 522         libdirs
.append("/usr/X11R6/lib") 
 525     # Move the various -I, -D, etc. flags we got from the *config scripts 
 526     # into the distutils lists. 
 527     cflags 
= adjustCFLAGS(cflags
, defines
, includes
) 
 528     lflags 
= adjustLFLAGS(lflags
, libdirs
, libs
) 
 531 #---------------------------------------------------------------------- 
 533     raise 'Sorry Charlie, platform not supported...' 
 536 #---------------------------------------------------------------------- 
 537 # post platform setup checks and tweaks, create the full version string 
 538 #---------------------------------------------------------------------- 
 541     BUILD_BASE 
= BUILD_BASE 
+ '.unicode' 
 545 VERSION 
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
, 
 546                              VER_SUBREL
, VER_FLAGS
) 
 548 #---------------------------------------------------------------------- 
 549 # Update the version file 
 550 #---------------------------------------------------------------------- 
 552 # Unconditionally updated since the version string can change based 
 553 # on the UNICODE flag 
 554 open('src/__version__.py', 'w').write("""\ 
 555 # This file was generated by setup.py... 
 557 wxVERSION_STRING  = '%(VERSION)s' 
 558 wxMAJOR_VERSION   = %(VER_MAJOR)s 
 559 wxMINOR_VERSION   = %(VER_MINOR)s 
 560 wxRELEASE_VERSION = %(VER_RELEASE)s 
 561 wxSUBREL_VERSION  = %(VER_SUBREL)s 
 563 wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION, 
 564              wxSUBREL_VERSION, '%(VER_FLAGS)s') 
 566 wxRELEASE_NUMBER = wxRELEASE_VERSION  # for compatibility 
 572 #---------------------------------------------------------------------- 
 574 #---------------------------------------------------------------------- 
 577 swig_args 
= ['-c++', '-shadow', '-python', '-keyword', 
 580              #'-docstring', '-Sbefore', 
 581              '-I./src', '-D'+WXPLAT
, 
 584     swig_args
.append('-DwxUSE_UNICODE') 
 586 swig_deps 
= ['src/my_typemaps.i'] 
 589 #---------------------------------------------------------------------- 
 590 # Define the CORE extension module 
 591 #---------------------------------------------------------------------- 
 593 msg('Preparing CORE...') 
 594 swig_files 
= [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i', 
 595                'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i', 
 596                'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i', 
 597                'printfw.i', 'sizers.i', 'clip_dnd.i', 
 598                'filesys.i', 'streams.i', 'utils.i', 'fonts.i' 
 601 swig_sources 
= run_swig(swig_files
, 'src', GENDIR
, PKGDIR
, 
 602                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 604 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0) 
 605 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0) 
 608 if IN_CVS_TREE
:   # update the license files 
 610     for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']: 
 611         copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0) 
 615     build_locale_dir(opj(PKGDIR
, 'locale')) 
 616     DATA_FILES 
+= build_locale_list(opj(PKGDIR
, 'locale')) 
 620     rc_file 
= ['src/wxc.rc'] 
 625 ext 
= Extension('wxc', ['src/helpers.cpp', 
 628                         ] + rc_file 
+ swig_sources
, 
 630                 include_dirs 
= includes
, 
 631                 define_macros 
= defines
, 
 633                 library_dirs 
= libdirs
, 
 636                 extra_compile_args 
= cflags
, 
 637                 extra_link_args 
= lflags
, 
 639 wxpExtensions
.append(ext
) 
 642 # Extension for the grid module 
 643 swig_sources 
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
, 
 644                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 645 ext 
= Extension('gridc', swig_sources
, 
 646                 include_dirs 
=  includes
, 
 647                 define_macros 
= defines
, 
 648                 library_dirs 
= libdirs
, 
 650                 extra_compile_args 
= cflags
, 
 651                 extra_link_args 
= lflags
, 
 653 wxpExtensions
.append(ext
) 
 656 # Extension for the html modules 
 657 swig_sources 
= run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR
, PKGDIR
, 
 658                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 659 ext 
= Extension('htmlc', swig_sources
, 
 660                 include_dirs 
=  includes
, 
 661                 define_macros 
= defines
, 
 662                 library_dirs 
= libdirs
, 
 664                 extra_compile_args 
= cflags
, 
 665                 extra_link_args 
= lflags
, 
 667 wxpExtensions
.append(ext
) 
 670 # Extension for the calendar module 
 671 swig_sources 
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
, 
 672                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 673 ext 
= Extension('calendarc', swig_sources
, 
 674                 include_dirs 
=  includes
, 
 675                 define_macros 
= defines
, 
 676                 library_dirs 
= libdirs
, 
 678                 extra_compile_args 
= cflags
, 
 679                 extra_link_args 
= lflags
, 
 681 wxpExtensions
.append(ext
) 
 684 # Extension for the help module 
 685 swig_sources 
= run_swig(['help.i'], 'src', GENDIR
, PKGDIR
, 
 686                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 687 ext 
= Extension('helpc', swig_sources
, 
 688                 include_dirs 
=  includes
, 
 689                 define_macros 
= defines
, 
 690                 library_dirs 
= libdirs
, 
 692                 extra_compile_args 
= cflags
, 
 693                 extra_link_args 
= lflags
, 
 695 wxpExtensions
.append(ext
) 
 698 # Extension for the wizard module 
 699 swig_sources 
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
, 
 700                         USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 701 ext 
= Extension('wizardc', swig_sources
, 
 702                 include_dirs 
=  includes
, 
 703                 define_macros 
= defines
, 
 704                 library_dirs 
= libdirs
, 
 706                 extra_compile_args 
= cflags
, 
 707                 extra_link_args 
= lflags
, 
 709 wxpExtensions
.append(ext
) 
 712 #---------------------------------------------------------------------- 
 713 # Define the GLCanvas extension module 
 714 #---------------------------------------------------------------------- 
 717     msg('Preparing GLCANVAS...') 
 718     location 
= 'contrib/glcanvas' 
 719     swig_files 
= ['glcanvas.i'] 
 722     swig_sources 
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
, 
 723                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 726     if os
.name 
== 'posix': 
 727         gl_config 
= os
.popen(WX_CONFIG 
+ ' --gl-libs', 'r').read()[:-1] 
 728         gl_lflags 
= gl_config
.split() + lflags
 
 731         other_sources 
= [opj(location
, 'msw/myglcanvas.cpp')] 
 732         gl_libs 
= libs 
+ ['opengl32', 'glu32'] 
 735     ext 
= Extension('glcanvasc', 
 736                     swig_sources 
+ other_sources
, 
 738                     include_dirs 
= includes
, 
 739                     define_macros 
= defines
, 
 741                     library_dirs 
= libdirs
, 
 744                     extra_compile_args 
= cflags
, 
 745                     extra_link_args 
= gl_lflags
, 
 748     wxpExtensions
.append(ext
) 
 751 #---------------------------------------------------------------------- 
 752 # Define the OGL extension module 
 753 #---------------------------------------------------------------------- 
 756     msg('Preparing OGL...') 
 757     location 
= 'contrib/ogl' 
 759     swig_files 
= ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i', 
 762     swig_sources 
= run_swig(swig_files
, location
, '', PKGDIR
, 
 763                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 765     ext 
= Extension('oglc', 
 768                     include_dirs 
=  includes
, 
 769                     define_macros 
= defines 
+ [('wxUSE_DEPRECATED', '0')], 
 771                     library_dirs 
= libdirs
, 
 772                     libraries 
= libs 
+ makeLibName('ogl'), 
 774                     extra_compile_args 
= cflags
, 
 775                     extra_link_args 
= lflags
, 
 778     wxpExtensions
.append(ext
) 
 782 #---------------------------------------------------------------------- 
 783 # Define the STC extension module 
 784 #---------------------------------------------------------------------- 
 787     msg('Preparing STC...') 
 788     location 
= 'contrib/stc' 
 789     STC_H 
= opj(WXPREFIX
, 'include/wx/stc') 
 791 ## NOTE: need to add this to the stc.bkl... 
 793 ##         # Check if gen_iface needs to be run for the wxSTC sources 
 794 ##         if (newer(opj(CTRB_SRC, 'stc/stc.h.in'),     opj(CTRB_INC, 'stc/stc.h'  )) or 
 795 ##             newer(opj(CTRB_SRC, 'stc/stc.cpp.in'),   opj(CTRB_SRC, 'stc/stc.cpp')) or 
 796 ##             newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))): 
 798 ##             msg('Running gen_iface.py, regenerating stc.h and stc.cpp...') 
 800 ##             os.chdir(opj(CTRB_SRC, 'stc')) 
 801 ##             sys.path.insert(0, os.curdir) 
 803 ##             gen_iface.main([]) 
 807     swig_files 
= ['stc_.i'] 
 808     swig_sources 
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
, 
 809                             USE_SWIG
, swig_force
, 
 810                             swig_args 
+ ['-I'+STC_H
, '-I'+location
], 
 811                             [opj(STC_H
, 'stc.h')] + swig_deps
) 
 813     # copy a contrib project specific py module to the main package dir 
 814     copy_file(opj(location
, 'stc.py'), PKGDIR
, update
=1, verbose
=0) 
 816     ext 
= Extension('stc_c', 
 819                     include_dirs 
= includes
, 
 820                     define_macros 
= defines
, 
 822                     library_dirs 
= libdirs
, 
 823                     libraries 
= libs 
+ makeLibName('stc'), 
 825                     extra_compile_args 
= cflags
, 
 826                     extra_link_args 
= lflags
, 
 829     wxpExtensions
.append(ext
) 
 833 #---------------------------------------------------------------------- 
 834 # Define the IEWIN extension module (experimental) 
 835 #---------------------------------------------------------------------- 
 838     msg('Preparing IEWIN...') 
 839     location 
= 'contrib/iewin' 
 841     swig_files 
= ['iewin.i', ] 
 843     swig_sources 
= run_swig(swig_files
, location
, '', PKGDIR
, 
 844                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 847     ext 
= Extension('iewinc', ['%s/IEHtmlWin.cpp' % location
, 
 848                                '%s/wxactivex.cpp' % location
, 
 851                     include_dirs 
=  includes
, 
 852                     define_macros 
= defines
, 
 854                     library_dirs 
= libdirs
, 
 857                     extra_compile_args 
= cflags
, 
 858                     extra_link_args 
= lflags
, 
 861     wxpExtensions
.append(ext
) 
 864 #---------------------------------------------------------------------- 
 865 # Define the XRC extension module 
 866 #---------------------------------------------------------------------- 
 869     msg('Preparing XRC...') 
 870     location 
= 'contrib/xrc' 
 872     swig_files 
= ['xrc.i'] 
 873     swig_sources 
= run_swig(swig_files
, location
, '', PKGDIR
, 
 874                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 876     ext 
= Extension('xrcc', 
 879                     include_dirs 
=  includes
, 
 880                     define_macros 
= defines
, 
 882                     library_dirs 
= libdirs
, 
 883                     libraries 
= libs 
+ makeLibName('xrc'), 
 885                     extra_compile_args 
= cflags
, 
 886                     extra_link_args 
= lflags
, 
 889     wxpExtensions
.append(ext
) 
 893 #---------------------------------------------------------------------- 
 894 # Define the GIZMOS  extension module 
 895 #---------------------------------------------------------------------- 
 898     msg('Preparing GIZMOS...') 
 899     location 
= 'contrib/gizmos' 
 901     swig_files 
= ['gizmos.i'] 
 902     swig_sources 
= run_swig(swig_files
, location
, '', PKGDIR
, 
 903                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 905     ext 
= Extension('gizmosc', 
 906                     [ '%s/treelistctrl.cpp' % location 
] + swig_sources
, 
 908                     include_dirs 
=  includes
, 
 909                     define_macros 
= defines
, 
 911                     library_dirs 
= libdirs
, 
 912                     libraries 
= libs 
+ makeLibName('gizmos'), 
 914                     extra_compile_args 
= cflags
, 
 915                     extra_link_args 
= lflags
, 
 918     wxpExtensions
.append(ext
) 
 922 #---------------------------------------------------------------------- 
 923 # Define the DLLWIDGET  extension module 
 924 #---------------------------------------------------------------------- 
 927     msg('Preparing DLLWIDGET...') 
 928     location 
= 'contrib/dllwidget' 
 929     swig_files 
= ['dllwidget_.i'] 
 931     swig_sources 
= run_swig(swig_files
, location
, '', PKGDIR
, 
 932                             USE_SWIG
, swig_force
, swig_args
, swig_deps
) 
 934     # copy a contrib project specific py module to the main package dir 
 935     copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0) 
 937     ext 
= Extension('dllwidget_c', [ 
 938                                 '%s/dllwidget.cpp' % location
, 
 941                     include_dirs 
=  includes
, 
 942                     define_macros 
= defines
, 
 944                     library_dirs 
= libdirs
, 
 947                     extra_compile_args 
= cflags
, 
 948                     extra_link_args 
= lflags
, 
 951     wxpExtensions
.append(ext
) 
 956 #---------------------------------------------------------------------- 
 958 #---------------------------------------------------------------------- 
 963     SCRIPTS 
= [opj('scripts/helpviewer'), 
 964                opj('scripts/img2png'), 
 965                opj('scripts/img2xpm'), 
 966                opj('scripts/img2py'), 
 967                opj('scripts/xrced'), 
 968                opj('scripts/pyshell'), 
 969                opj('scripts/pycrust'), 
 970                opj('scripts/pywrap'), 
 971                opj('scripts/pywrap'), 
 972                opj('scripts/pyalacarte'), 
 973                opj('scripts/pyalamode'), 
 977 DATA_FILES 
+= find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc') 
 978 DATA_FILES 
+= find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html') 
 979 DATA_FILES 
+= find_data_files('wx', '*.txt', '*.css', '*.html') 
 982 #---------------------------------------------------------------------- 
 983 # Do the Setup/Build/Install/Whatever 
 984 #---------------------------------------------------------------------- 
 986 if __name__ 
== "__main__": 
 990               description      
= DESCRIPTION
, 
 991               long_description 
= LONG_DESCRIPTION
, 
 993               author_email     
= AUTHOR_EMAIL
, 
 997               packages 
= ['wxPython', 
 999                           'wxPython.lib.colourchooser', 
1000                           'wxPython.lib.editor', 
1001                           'wxPython.lib.mixins', 
1002                           'wxPython.lib.PyCrust', 
1006                           'wxPython.tools.XRCed', 
1010                           'wx.lib.colourchooser', 
1018               ext_package 
= PKGDIR
, 
1019               ext_modules 
= wxpExtensions
, 
1021               options 
= { 'build' : { 'build_base' : BUILD_BASE }
}, 
1025               cmdclass 
= { 'install_data': smart_install_data}
, 
1026               data_files 
= DATA_FILES
, 
1031 #---------------------------------------------------------------------- 
1032 #----------------------------------------------------------------------