2 #----------------------------------------------------------------------
4 import sys
, os
, glob
, fnmatch
, commands
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 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 UNICODE
= 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
78 # will ensure that the right headers are found and the
79 # right libs are linked.
81 IN_CVS_TREE
= 1 # Set to true if building in a full wxWindows CVS
82 # tree, or the new style of a full wxPythonSrc tarball.
83 # wxPython used to be distributed as a separate source
84 # tarball without the wxWindows but with a copy of the
85 # needed contrib code. That's no longer the case and so
86 # this setting is now defaulting to true. Eventually it
87 # should be removed entirly.
89 UNDEF_NDEBUG
= 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
90 # and distutils will pick this up and use it on the
91 # compile command-line for the extensions. This could
92 # conflict with how wxWindows was built. If NDEBUG is
93 # set then wxWindows' __WXDEBUG__ setting will be turned
94 # off. If wxWindows was actually built with it turned
95 # on then you end up with mismatched class structures,
96 # and wxPython will crash.
98 NO_SCRIPTS
= 0 # Don't install the tool scripts
100 WX_CONFIG
= None # Usually you shouldn't need to touch this, but you can set
101 # it to pass an alternate version of wx-config or alternate
102 # flags, eg. as required by the .deb in-tree build. By
103 # default a wx-config command will be assembled based on
104 # version, port, etc. and it will be looked for on the
107 WXPORT
= 'gtk' # On Linux/Unix there are several ports of wxWindows available.
108 # Setting this value lets you select which will be used for
109 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
110 # 'x11'. Curently only gtk and gtk2 works.
112 BUILD_BASE
= "build" # Directory to use for temporary build files.
116 # Some MSW build settings
118 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
119 # (0 or 1 only) should probably find a way to
122 HYBRID
= 1 # If set and not debug or FINAL, then build a
123 # hybrid extension that can be used by the
124 # non-debug version of python, but contains
125 # debugging symbols for wxWindows and wxPython.
126 # wxWindows must have been built with /MD, not /MDd
127 # (using FINAL=hybrid will do it.)
129 # Version part of wxWindows LIB/DLL names
130 WXDLLVER
= '%d%d' % (VER_MAJOR
, VER_MINOR
)
133 #----------------------------------------------------------------------
136 if __name__
== "__main__":
141 path
= apply(os
.path
.join
, args
)
142 return os
.path
.normpath(path
)
157 #----------------------------------------------------------------------
159 #----------------------------------------------------------------------
165 force
= '--force' in sys
.argv
or '-f' in sys
.argv
166 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
168 # change the PORT default for wxMac
169 if sys
.platform
[:6] == "darwin":
172 # and do the same for wxMSW, just for consistency
177 #----------------------------------------------------------------------
178 # Check for build flags on the command line
179 #----------------------------------------------------------------------
181 # Boolean (int) flags
182 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
183 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
184 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'IN_CVS_TREE', 'UNICODE',
185 'UNDEF_NDEBUG', 'NO_SCRIPTS',
186 'FINAL', 'HYBRID', ]:
187 for x
in range(len(sys
.argv
)):
188 if sys
.argv
[x
].find(flag
) == 0:
189 pos
= sys
.argv
[x
].find('=') + 1
191 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
195 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT']:
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
)
228 WX_CONFIG
= 'wx%s%s%s-%s-config' % (WXPORT
, uf
, df
, ver2
)
230 searchpath
= os
.environ
["PATH"]
231 for p
in searchpath
.split(':'):
232 fp
= os
.path
.join(p
, WX_CONFIG
)
233 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
235 msg("Found wx-config: " + fp
)
239 msg("WX_CONFIG not specified and %s not found on $PATH "
240 "defaulting to \"wx-config\"" % WX_CONFIG
)
241 WX_CONFIG
= 'wx-config'
245 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
246 """Run SWIG the way I want it done"""
247 if not os
.path
.exists(os
.path
.join(dir, gendir
)):
248 os
.mkdir(os
.path
.join(dir, gendir
))
253 basefile
= os
.path
.splitext(file)[0]
254 i_file
= os
.path
.join(dir, file)
255 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
256 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'.cpp')
258 sources
.append(cpp_file
)
261 for dep
in swig_deps
:
262 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
266 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
267 # we need forward slashes here even on win32
268 cpp_file
= '/'.join(cpp_file
.split('\\'))
269 i_file
= '/'.join(i_file
.split('\\'))
271 cmd
= ['./wxSWIG/wxswig'] + swig_args
+ ['-I'+dir, '-c', '-o', cpp_file
, i_file
]
275 # copy the generated python file to the package directory
276 copy_file(py_file
, package
, update
=not force
, verbose
=0)
282 def contrib_copy_tree(src
, dest
, verbose
=0):
283 """Update local copies of wxWindows contrib files"""
284 from distutils
.dir_util
import mkpath
, copy_tree
286 mkpath(dest
, verbose
=verbose
)
287 copy_tree(src
, dest
, update
=1, verbose
=verbose
)
291 class smart_install_data(install_data
):
293 #need to change self.install_dir to the actual library dir
294 install_cmd
= self
.get_finalized_command('install')
295 self
.install_dir
= getattr(install_cmd
, 'install_lib')
296 return install_data
.run(self
)
299 def build_locale_dir(destdir
, verbose
=1):
300 """Build a locale dir under the wxPython package for MSW"""
301 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
303 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
304 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
305 mkpath(dest
, verbose
=verbose
)
306 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
309 def build_locale_list(srcdir
):
310 # get a list of all files under the srcdir, to be used for install_data
311 def walk_helper(lst
, dirname
, files
):
313 filename
= opj(dirname
, f
)
314 if not os
.path
.isdir(filename
):
315 lst
.append( (dirname
, [filename
]) )
317 os
.path
.walk(srcdir
, walk_helper
, file_list
)
321 def find_data_files(srcdir
, *wildcards
):
322 # get a list of all files under the srcdir matching wildcards,
323 # returned in a format to be used for install_data
325 def walk_helper(arg
, dirname
, files
):
330 filename
= opj(dirname
, f
)
331 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
):
332 names
.append(filename
)
334 lst
.append( (dirname
, names
) )
337 os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
))
341 def makeLibName(name
):
342 if os
.name
== 'posix':
343 libname
= '%s_%s-%s' % (WXBASENAME
, name
, WXRELEASE
)
345 libname
= 'wxmsw%s%s_%s' % (WXDLLVER
, libFlag(), name
)
351 def adjustCFLAGS(cflags
, defines
, includes
):
352 '''Extract the raw -I, -D, and -U flags and put them into
353 defines and includes as needed.'''
357 includes
.append(flag
[2:])
358 elif flag
[:2] == '-D':
360 if flag
.find('=') == -1:
361 defines
.append( (flag
, None) )
363 defines
.append( tuple(flag
.split('=')) )
364 elif flag
[:2] == '-U':
365 defines
.append( (flag
[2:], ) )
367 newCFLAGS
.append(flag
)
372 def adjustLFLAGS(lfags
, libdirs
, libs
):
373 '''Extract the -L and -l flags and put them in libdirs and libs as needed'''
377 libdirs
.append(flag
[2:])
378 elif flag
[:2] == '-l':
379 libs
.append(flag
[2:])
381 newLFLAGS
.append(flag
)
385 #----------------------------------------------------------------------
404 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
405 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
408 #----------------------------------------------------------------------
409 # Setup some platform specific stuff
410 #----------------------------------------------------------------------
413 # Set compile flags and such for MSVC. These values are derived
414 # from the wxWindows makefiles for MSVC, other compilers settings
415 # will probably vary...
416 if os
.environ
.has_key('WXWIN'):
417 WXDIR
= os
.environ
['WXWIN']
419 msg("WARNING: WXWIN not set in environment.")
420 WXDIR
= '..' # assumes in CVS tree
425 opj(WXDIR
, 'lib', 'vc_dll', 'msw' + libFlag()),
426 opj(WXDIR
, 'include'),
427 opj(WXDIR
, 'contrib', 'include'),
430 defines
= [ ('WIN32', None),
436 ('SWIG_GLOBAL', None),
437 ('HAVE_CONFIG_H', None),
438 ('WXP_USE_THREAD', '1'),
442 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
445 if not FINAL
or HYBRID
:
446 defines
.append( ('__WXDEBUG__', None) )
448 libdirs
= [ opj(WXDIR
, 'lib', 'vc_dll') ]
449 libs
= [ 'wxbase' + WXDLLVER
+ libFlag(), # TODO: trim this down to what is really needed for the core
450 'wxbase' + WXDLLVER
+ libFlag() + '_net',
451 'wxbase' + WXDLLVER
+ libFlag() + '_xml',
452 makeLibName('core')[0],
453 makeLibName('adv')[0],
454 makeLibName('html')[0],
457 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
458 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
459 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
460 'advapi32', 'wsock32']
464 # '/GX-' # workaround for internal compiler error in MSVC on some machines
468 # Other MSVC flags...
469 # Too bad I don't remember why I was playing with these, can they be removed?
471 pass #cflags = cflags + ['/O1']
473 pass #cflags = cflags + ['/Ox']
475 pass # cflags = cflags + ['/Od', '/Z7']
476 # lflags = ['/DEBUG', ]
480 #----------------------------------------------------------------------
482 elif os
.name
== 'posix':
483 WXDIR
= '..' # assumes IN_CVS_TREE
485 defines
= [('SWIG_GLOBAL', None),
486 ('HAVE_CONFIG_H', None),
487 ('WXP_USE_THREAD', '1'),
490 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
497 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
498 cflags
= cflags
.split()
505 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
506 lflags
= lflags
.split()
508 WXBASENAME
= os
.popen(WX_CONFIG
+ ' --basename').read()[:-1]
509 WXRELEASE
= os
.popen(WX_CONFIG
+ ' --release').read()[:-1]
510 WXPREFIX
= os
.popen(WX_CONFIG
+ ' --prefix').read()[:-1]
513 if sys
.platform
[:6] == "darwin":
514 # Flags and such for a Darwin (Max OS X) build of Python
522 # Set flags for other Unix type platforms
527 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
528 elif WXPORT
== 'gtk2':
530 GENDIR
= 'gtk' # no code differences so use the same generated sources
531 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
532 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
533 elif WXPORT
== 'x11':
536 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
538 raise SystemExit, "Unknown WXPORT value: " + WXPORT
540 cflags
+= portcfg
.split()
542 # If you get unresolved symbol errors on Solaris and are using gcc, then
543 # uncomment this block to add the right flags to the link step and build
545 ## if os.uname()[0] == 'SunOS':
546 ## libs.append('gcc')
547 ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
550 # Move the various -I, -D, etc. flags we got from the *config scripts
551 # into the distutils lists.
552 cflags
= adjustCFLAGS(cflags
, defines
, includes
)
553 lflags
= adjustLFLAGS(lflags
, libdirs
, libs
)
556 #----------------------------------------------------------------------
558 raise 'Sorry Charlie, platform not supported...'
561 #----------------------------------------------------------------------
562 # post platform setup checks and tweaks, create the full version string
563 #----------------------------------------------------------------------
566 BUILD_BASE
= BUILD_BASE
+ '.unicode'
570 VERSION
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
,
571 VER_SUBREL
, VER_FLAGS
)
573 #----------------------------------------------------------------------
574 # Update the version file
575 #----------------------------------------------------------------------
577 # Unconditionally updated since the version string can change based
578 # on the UNICODE flag
579 open('src/__version__.py', 'w').write("""\
580 # This file was generated by setup.py...
582 wxVERSION_STRING = '%(VERSION)s'
583 wxMAJOR_VERSION = %(VER_MAJOR)s
584 wxMINOR_VERSION = %(VER_MINOR)s
585 wxRELEASE_VERSION = %(VER_RELEASE)s
586 wxSUBREL_VERSION = %(VER_SUBREL)s
588 wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION,
589 wxSUBREL_VERSION, '%(VER_FLAGS)s')
591 wxRELEASE_NUMBER = wxRELEASE_VERSION # for compatibility
597 #----------------------------------------------------------------------
599 #----------------------------------------------------------------------
602 swig_args
= ['-c++', '-shadow', '-python', '-keyword',
605 #'-docstring', '-Sbefore',
606 '-I./src', '-D'+WXPLAT
,
609 swig_args
.append('-DwxUSE_UNICODE')
611 swig_deps
= ['src/my_typemaps.i']
614 #----------------------------------------------------------------------
615 # Define the CORE extension module
616 #----------------------------------------------------------------------
618 msg('Preparing CORE...')
619 swig_files
= [ 'wx.i', 'windows.i', 'windows2.i', 'windows3.i', 'events.i',
620 'misc.i', 'misc2.i', 'gdi.i', 'mdi.i', 'controls.i',
621 'controls2.i', 'cmndlgs.i', 'stattool.i', 'frames.i', 'image.i',
622 'printfw.i', 'sizers.i', 'clip_dnd.i',
623 'filesys.i', 'streams.i', 'utils.i', 'fonts.i'
626 swig_sources
= run_swig(swig_files
, 'src', GENDIR
, PKGDIR
,
627 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
629 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
630 copy_file('src/__version__.py', PKGDIR
, update
=1, verbose
=0)
633 if IN_CVS_TREE
: # update the license files
635 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
636 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
640 build_locale_dir(opj(PKGDIR
, 'locale'))
641 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
645 rc_file
= ['src/wxc.rc']
650 ext
= Extension('wxc', ['src/helpers.cpp',
653 ] + rc_file
+ swig_sources
,
655 include_dirs
= includes
,
656 define_macros
= defines
,
658 library_dirs
= libdirs
,
661 extra_compile_args
= cflags
,
662 extra_link_args
= lflags
,
664 wxpExtensions
.append(ext
)
667 # Extension for the grid module
668 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
669 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
670 ext
= Extension('gridc', swig_sources
,
671 include_dirs
= includes
,
672 define_macros
= defines
,
673 library_dirs
= libdirs
,
675 extra_compile_args
= cflags
,
676 extra_link_args
= lflags
,
678 wxpExtensions
.append(ext
)
681 # Extension for the html modules
682 swig_sources
= run_swig(['html.i', 'htmlhelp.i'], 'src', GENDIR
, PKGDIR
,
683 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
684 ext
= Extension('htmlc', swig_sources
,
685 include_dirs
= includes
,
686 define_macros
= defines
,
687 library_dirs
= libdirs
,
689 extra_compile_args
= cflags
,
690 extra_link_args
= lflags
,
692 wxpExtensions
.append(ext
)
695 # Extension for the calendar module
696 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
697 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
698 ext
= Extension('calendarc', swig_sources
,
699 include_dirs
= includes
,
700 define_macros
= defines
,
701 library_dirs
= libdirs
,
703 extra_compile_args
= cflags
,
704 extra_link_args
= lflags
,
706 wxpExtensions
.append(ext
)
709 # Extension for the help module
710 swig_sources
= run_swig(['help.i'], 'src', GENDIR
, PKGDIR
,
711 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
712 ext
= Extension('helpc', swig_sources
,
713 include_dirs
= includes
,
714 define_macros
= defines
,
715 library_dirs
= libdirs
,
717 extra_compile_args
= cflags
,
718 extra_link_args
= lflags
,
720 wxpExtensions
.append(ext
)
723 # Extension for the wizard module
724 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
725 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
726 ext
= Extension('wizardc', swig_sources
,
727 include_dirs
= includes
,
728 define_macros
= defines
,
729 library_dirs
= libdirs
,
731 extra_compile_args
= cflags
,
732 extra_link_args
= lflags
,
734 wxpExtensions
.append(ext
)
737 #----------------------------------------------------------------------
738 # Define the GLCanvas extension module
739 #----------------------------------------------------------------------
742 msg('Preparing GLCANVAS...')
743 location
= 'contrib/glcanvas'
744 swig_files
= ['glcanvas.i']
746 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
747 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
750 if os
.name
== 'posix':
751 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
752 gl_lflags
= gl_config
.split() + lflags
755 gl_libs
= libs
+ ['opengl32', 'glu32'] + makeLibName('gl')
758 ext
= Extension('glcanvasc',
761 include_dirs
= includes
,
762 define_macros
= defines
,
764 library_dirs
= libdirs
,
767 extra_compile_args
= cflags
,
768 extra_link_args
= gl_lflags
,
771 wxpExtensions
.append(ext
)
774 #----------------------------------------------------------------------
775 # Define the OGL extension module
776 #----------------------------------------------------------------------
779 msg('Preparing OGL...')
780 location
= 'contrib/ogl'
782 swig_files
= ['ogl.i', 'oglbasic.i', 'oglshapes.i', 'oglshapes2.i',
785 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
786 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
788 ext
= Extension('oglc',
791 include_dirs
= includes
,
792 define_macros
= defines
+ [('wxUSE_DEPRECATED', '0')],
794 library_dirs
= libdirs
,
795 libraries
= libs
+ makeLibName('ogl'),
797 extra_compile_args
= cflags
,
798 extra_link_args
= lflags
,
801 wxpExtensions
.append(ext
)
805 #----------------------------------------------------------------------
806 # Define the STC extension module
807 #----------------------------------------------------------------------
810 msg('Preparing STC...')
811 location
= 'contrib/stc'
813 STC_H
= opj(WXDIR
, 'contrib', 'include/wx/stc')
815 STC_H
= opj(WXPREFIX
, 'include/wx/stc')
817 ## NOTE: need to add this to the stc.bkl...
819 ## # Check if gen_iface needs to be run for the wxSTC sources
820 ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
821 ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
822 ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
824 ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
826 ## os.chdir(opj(CTRB_SRC, 'stc'))
827 ## sys.path.insert(0, os.curdir)
829 ## gen_iface.main([])
833 swig_files
= ['stc_.i']
834 swig_sources
= run_swig(swig_files
, location
, GENDIR
, PKGDIR
,
835 USE_SWIG
, swig_force
,
836 swig_args
+ ['-I'+STC_H
, '-I'+location
],
837 [opj(STC_H
, 'stc.h')] + swig_deps
)
839 # copy a contrib project specific py module to the main package dir
840 copy_file(opj(location
, 'stc.py'), PKGDIR
, update
=1, verbose
=0)
842 ext
= Extension('stc_c',
845 include_dirs
= includes
,
846 define_macros
= defines
,
848 library_dirs
= libdirs
,
849 libraries
= libs
+ makeLibName('stc'),
851 extra_compile_args
= cflags
,
852 extra_link_args
= lflags
,
855 wxpExtensions
.append(ext
)
859 #----------------------------------------------------------------------
860 # Define the IEWIN extension module (experimental)
861 #----------------------------------------------------------------------
864 msg('Preparing IEWIN...')
865 location
= 'contrib/iewin'
867 swig_files
= ['iewin.i', ]
869 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
870 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
873 ext
= Extension('iewinc', ['%s/IEHtmlWin.cpp' % location
,
874 '%s/wxactivex.cpp' % location
,
877 include_dirs
= includes
,
878 define_macros
= defines
,
880 library_dirs
= libdirs
,
883 extra_compile_args
= cflags
,
884 extra_link_args
= lflags
,
887 wxpExtensions
.append(ext
)
890 #----------------------------------------------------------------------
891 # Define the XRC extension module
892 #----------------------------------------------------------------------
895 msg('Preparing XRC...')
896 location
= 'contrib/xrc'
898 swig_files
= ['xrc.i']
899 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
900 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
902 ext
= Extension('xrcc',
905 include_dirs
= includes
,
906 define_macros
= defines
,
908 library_dirs
= libdirs
,
909 libraries
= libs
+ makeLibName('xrc'),
911 extra_compile_args
= cflags
,
912 extra_link_args
= lflags
,
915 wxpExtensions
.append(ext
)
919 #----------------------------------------------------------------------
920 # Define the GIZMOS extension module
921 #----------------------------------------------------------------------
924 msg('Preparing GIZMOS...')
925 location
= 'contrib/gizmos'
927 swig_files
= ['gizmos.i']
928 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
929 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
931 ext
= Extension('gizmosc',
932 [ '%s/treelistctrl.cpp' % location
] + swig_sources
,
934 include_dirs
= includes
,
935 define_macros
= defines
,
937 library_dirs
= libdirs
,
938 libraries
= libs
+ makeLibName('gizmos'),
940 extra_compile_args
= cflags
,
941 extra_link_args
= lflags
,
944 wxpExtensions
.append(ext
)
948 #----------------------------------------------------------------------
949 # Define the DLLWIDGET extension module
950 #----------------------------------------------------------------------
953 msg('Preparing DLLWIDGET...')
954 location
= 'contrib/dllwidget'
955 swig_files
= ['dllwidget_.i']
957 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
958 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
960 # copy a contrib project specific py module to the main package dir
961 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
963 ext
= Extension('dllwidget_c', [
964 '%s/dllwidget.cpp' % location
,
967 include_dirs
= includes
,
968 define_macros
= defines
,
970 library_dirs
= libdirs
,
973 extra_compile_args
= cflags
,
974 extra_link_args
= lflags
,
977 wxpExtensions
.append(ext
)
982 #----------------------------------------------------------------------
984 #----------------------------------------------------------------------
989 SCRIPTS
= [opj('scripts/helpviewer'),
990 opj('scripts/img2png'),
991 opj('scripts/img2xpm'),
992 opj('scripts/img2py'),
993 opj('scripts/xrced'),
994 opj('scripts/pyshell'),
995 opj('scripts/pycrust'),
996 opj('scripts/pywrap'),
997 opj('scripts/pywrap'),
998 opj('scripts/pyalacarte'),
999 opj('scripts/pyalamode'),
1003 DATA_FILES
+= find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc')
1004 DATA_FILES
+= find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html')
1005 DATA_FILES
+= find_data_files('wx', '*.txt', '*.css', '*.html')
1008 #----------------------------------------------------------------------
1009 # Do the Setup/Build/Install/Whatever
1010 #----------------------------------------------------------------------
1012 if __name__
== "__main__":
1014 setup(name
= PKGDIR
,
1016 description
= DESCRIPTION
,
1017 long_description
= LONG_DESCRIPTION
,
1019 author_email
= AUTHOR_EMAIL
,
1021 download_url
= DOWNLOAD_URL
,
1023 platforms
= PLATFORMS
,
1024 classifiers
= filter(None, CLASSIFIERS
.split("\n")),
1025 keywords
= KEYWORDS
,
1027 packages
= ['wxPython',
1029 'wxPython.lib.colourchooser',
1030 'wxPython.lib.editor',
1031 'wxPython.lib.mixins',
1032 'wxPython.lib.PyCrust',
1036 'wxPython.tools.XRCed',
1040 'wx.lib.colourchooser',
1048 ext_package
= PKGDIR
,
1049 ext_modules
= wxpExtensions
,
1051 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1055 cmdclass
= { 'install_data': smart_install_data}
,
1056 data_files
= DATA_FILES
,
1061 #----------------------------------------------------------------------
1062 #----------------------------------------------------------------------