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
11 import distutils
.command
.install_data
12 import distutils
.command
.clean
14 #----------------------------------------------------------------------
15 # flags and values that affect this script
16 #----------------------------------------------------------------------
18 VER_MAJOR
= 2 # The first three must match wxWidgets
21 VER_SUBREL
= 2 # wxPython release num for x.y.z release of wxWidgets
22 VER_FLAGS
= "p" # release flags, such as prerelease num, unicode, etc.
24 DESCRIPTION
= "Cross platform GUI toolkit for Python"
26 AUTHOR_EMAIL
= "Robin Dunn <robin@alldunn.com>"
27 URL
= "http://wxPython.org/"
28 DOWNLOAD_URL
= "http://wxPython.org/download.php"
29 LICENSE
= "wxWidgets Library License (LGPL derivative)"
30 PLATFORMS
= "WIN32,OSX,POSIX"
31 KEYWORDS
= "GUI,wx,wxWindows,wxWidgetscross-platform"
33 LONG_DESCRIPTION
= """\
34 wxPython is a GUI toolkit for Python that is a wrapper around the
35 wxWidgets C++ GUI library. wxPython provides a large variety of
36 window types and controls, all implemented with a native look and
37 feel (by using the native widgets) on the platforms it is supported
42 Development Status :: 6 - Mature
43 Environment :: MacOS X :: Carbon
44 Environment :: Win32 (MS Windows)
45 Environment :: X11 Applications :: GTK
46 Intended Audience :: Developers
47 License :: OSI Approved
48 Operating System :: MacOS :: MacOS X
49 Operating System :: Microsoft :: Windows :: Windows 95/98/2000
50 Operating System :: POSIX
51 Programming Language :: Python
52 Topic :: Software Development :: User Interfaces
55 ## License :: OSI Approved :: wxWidgets Library Licence
58 # Config values below this point can be reset on the setup.py command line.
60 BUILD_GLCANVAS
= 1 # If true, build the contrib/glcanvas extension module
61 BUILD_OGL
= 1 # If true, build the contrib/ogl extension module
62 BUILD_STC
= 1 # If true, build the contrib/stc extension module
63 BUILD_XRC
= 1 # XML based resource system
64 BUILD_GIZMOS
= 1 # Build a module for the gizmos contrib library
65 BUILD_DLLWIDGET
= 0# Build a module that enables unknown wx widgets
66 # to be loaded from a DLL and to be used from Python.
68 # Internet Explorer wrapper (experimental)
69 BUILD_IEWIN
= (os
.name
== 'nt')
72 CORE_ONLY
= 0 # if true, don't build any of the above
74 PREP_ONLY
= 0 # Only run the prepatory steps, not the actual build.
76 USE_SWIG
= 0 # Should we actually execute SWIG, or just use the
77 # files already in the distribution?
79 SWIG
= "swig" # The swig executable to use.
81 BUILD_RENAMERS
= 1 # Should we build the renamer modules too?
83 UNICODE
= 0 # This will pass the 'wxUSE_UNICODE' flag to SWIG and
84 # will ensure that the right headers are found and the
85 # right libs are linked.
87 UNDEF_NDEBUG
= 1 # Python 2.2 on Unix/Linux by default defines NDEBUG,
88 # and distutils will pick this up and use it on the
89 # compile command-line for the extensions. This could
90 # conflict with how wxWidgets was built. If NDEBUG is
91 # set then wxWidgets' __WXDEBUG__ setting will be turned
92 # off. If wxWidgets was actually built with it turned
93 # on then you end up with mismatched class structures,
94 # and wxPython will crash.
96 NO_SCRIPTS
= 0 # Don't install the tool scripts
98 WX_CONFIG
= None # Usually you shouldn't need to touch this, but you can set
99 # it to pass an alternate version of wx-config or alternate
100 # flags, eg. as required by the .deb in-tree build. By
101 # default a wx-config command will be assembled based on
102 # version, port, etc. and it will be looked for on the
105 WXPORT
= 'gtk' # On Linux/Unix there are several ports of wxWidgets available.
106 # Setting this value lets you select which will be used for
107 # the wxPython build. Possibilites are 'gtk', 'gtk2' and
108 # 'x11'. Curently only gtk and gtk2 works.
110 BUILD_BASE
= "build" # Directory to use for temporary build files.
111 # This name will be appended to if the WXPORT or
112 # the UNICODE flags are set to non-standard
116 CONTRIBS_INC
= "" # A dir to add as an -I flag when compiling the contribs
119 # Some MSW build settings
121 FINAL
= 0 # Mirrors use of same flag in wx makefiles,
122 # (0 or 1 only) should probably find a way to
125 HYBRID
= 1 # If set and not debug or FINAL, then build a
126 # hybrid extension that can be used by the
127 # non-debug version of python, but contains
128 # debugging symbols for wxWidgets and wxPython.
129 # wxWidgets must have been built with /MD, not /MDd
130 # (using FINAL=hybrid will do it.)
132 # Version part of wxWidgets LIB/DLL names
133 WXDLLVER
= '%d%d' % (VER_MAJOR
, VER_MINOR
)
136 #----------------------------------------------------------------------
139 if __name__
== "__main__":
144 path
= apply(os
.path
.join
, args
)
145 return os
.path
.normpath(path
)
160 #----------------------------------------------------------------------
162 #----------------------------------------------------------------------
169 force
= '--force' in sys
.argv
or '-f' in sys
.argv
170 debug
= '--debug' in sys
.argv
or '-g' in sys
.argv
171 cleaning
= 'clean' in sys
.argv
174 # change the PORT default for wxMac
175 if sys
.platform
[:6] == "darwin":
178 # and do the same for wxMSW, just for consistency
183 #----------------------------------------------------------------------
184 # Check for build flags on the command line
185 #----------------------------------------------------------------------
187 # Boolean (int) flags
188 for flag
in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_XRC',
189 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN',
190 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE',
191 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'BUILD_RENAMERS',
192 'FINAL', 'HYBRID', ]:
193 for x
in range(len(sys
.argv
)):
194 if sys
.argv
[x
].find(flag
) == 0:
195 pos
= sys
.argv
[x
].find('=') + 1
197 vars()[flag
] = eval(sys
.argv
[x
][pos
:])
201 for option
in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG',
203 for x
in range(len(sys
.argv
)):
204 if sys
.argv
[x
].find(option
) == 0:
205 pos
= sys
.argv
[x
].find('=') + 1
207 vars()[option
] = sys
.argv
[x
][pos
:]
210 sys
.argv
= filter(None, sys
.argv
)
213 #----------------------------------------------------------------------
214 # some helper functions
215 #----------------------------------------------------------------------
217 def Verify_WX_CONFIG():
218 """ Called below for the builds that need wx-config,
219 if WX_CONFIG is not set then tries to select the specific
220 wx*-config script based on build options. If not found
221 then it defaults to 'wx-config'.
223 # if WX_CONFIG hasn't been set to an explicit value then construct one.
225 if WX_CONFIG
is None:
226 if debug
: # TODO: Fix this. wxPython's --debug shouldn't be tied to wxWidgets...
234 ver2
= "%s.%s" % (VER_MAJOR
, VER_MINOR
)
238 WX_CONFIG
= 'wx%s%s%s-%s-config' % (port
, uf
, df
, ver2
)
240 searchpath
= os
.environ
["PATH"]
241 for p
in searchpath
.split(':'):
242 fp
= os
.path
.join(p
, WX_CONFIG
)
243 if os
.path
.exists(fp
) and os
.access(fp
, os
.X_OK
):
245 msg("Found wx-config: " + fp
)
249 msg("WX_CONFIG not specified and %s not found on $PATH "
250 "defaulting to \"wx-config\"" % WX_CONFIG
)
251 WX_CONFIG
= 'wx-config'
255 def run_swig(files
, dir, gendir
, package
, USE_SWIG
, force
, swig_args
, swig_deps
=[]):
256 """Run SWIG the way I want it done"""
258 if USE_SWIG
and not os
.path
.exists(os
.path
.join(dir, gendir
)):
259 os
.mkdir(os
.path
.join(dir, gendir
))
261 if USE_SWIG
and not os
.path
.exists(os
.path
.join("docs", "xml-raw")):
262 os
.mkdir(os
.path
.join("docs", "xml-raw"))
267 basefile
= os
.path
.splitext(file)[0]
268 i_file
= os
.path
.join(dir, file)
269 py_file
= os
.path
.join(dir, gendir
, basefile
+'.py')
270 cpp_file
= os
.path
.join(dir, gendir
, basefile
+'_wrap.cpp')
271 xml_file
= os
.path
.join("docs", "xml-raw", basefile
+'_swig.xml')
273 sources
.append(cpp_file
)
275 if not cleaning
and USE_SWIG
:
276 for dep
in swig_deps
:
277 if newer(dep
, py_file
) or newer(dep
, cpp_file
):
281 if force
or newer(i_file
, py_file
) or newer(i_file
, cpp_file
):
282 ## we need forward slashes here even on win32
283 #cpp_file = opj(cpp_file) #'/'.join(cpp_file.split('\\'))
284 #i_file = opj(i_file) #'/'.join(i_file.split('\\'))
287 #tempfile.tempdir = sourcePath
288 xmltemp
= tempfile
.mktemp('.xml')
290 # First run swig to produce the XML file, adding
291 # an extra -D that prevents the old rename
292 # directives from being used
293 cmd
= [ swig_cmd
] + swig_args
+ \
294 [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp
] + \
295 ['-I'+dir, '-o', cpp_file
, i_file
]
299 # Next run build_renamers to process the XML
300 cmd
= [ sys
.executable
, '-u',
301 './distrib/build_renamers.py', dir, basefile
, xmltemp
]
306 # Then run swig for real
307 cmd
= [ swig_cmd
] + swig_args
+ ['-I'+dir, '-o', cpp_file
,
308 '-xmlout', xml_file
, i_file
]
313 # copy the generated python file to the package directory
314 copy_file(py_file
, package
, update
=not force
, verbose
=0)
315 CLEANUP
.append(opj(package
, os
.path
.basename(py_file
)))
321 # Specializations of some distutils command classes
322 class smart_install_data(distutils
.command
.install_data
.install_data
):
323 """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 distutils
.command
.install_data
.install_data
.run(self
)
330 class extra_clean(distutils
.command
.clean
.clean
):
331 """Also cleans stuff that setup.py copies itself. If the --all
332 flag was used also searches for .pyc, .pyd, .so files"""
334 from distutils
import log
335 from distutils
.filelist
import FileList
338 distutils
.command
.clean
.clean
.run(self
)
342 fl
.include_pattern("*.pyc", 0)
343 fl
.include_pattern("*.pyd", 0)
344 fl
.include_pattern("*.so", 0)
350 if not self
.dry_run
and os
.path
.exists(f
):
352 log
.info("removing '%s'", f
)
354 log
.warning("unable to remove '%s'", f
)
358 if not self
.dry_run
and os
.path
.exists(f
):
360 log
.info("removing '%s'", f
)
362 log
.warning("unable to remove '%s'", f
)
367 def build_locale_dir(destdir
, verbose
=1):
368 """Build a locale dir under the wxPython package for MSW"""
369 moFiles
= glob
.glob(opj(WXDIR
, 'locale', '*.mo'))
371 lang
= os
.path
.splitext(os
.path
.basename(src
))[0]
372 dest
= opj(destdir
, lang
, 'LC_MESSAGES')
373 mkpath(dest
, verbose
=verbose
)
374 copy_file(src
, opj(dest
, 'wxstd.mo'), update
=1, verbose
=verbose
)
375 CLEANUP
.append(opj(dest
, 'wxstd.mo'))
379 def build_locale_list(srcdir
):
380 # get a list of all files under the srcdir, to be used for install_data
381 def walk_helper(lst
, dirname
, files
):
383 filename
= opj(dirname
, f
)
384 if not os
.path
.isdir(filename
):
385 lst
.append( (dirname
, [filename
]) )
387 os
.path
.walk(srcdir
, walk_helper
, file_list
)
391 def find_data_files(srcdir
, *wildcards
):
392 # get a list of all files under the srcdir matching wildcards,
393 # returned in a format to be used for install_data
395 def walk_helper(arg
, dirname
, files
):
400 filename
= opj(dirname
, f
)
401 if fnmatch
.fnmatch(filename
, wc
) and not os
.path
.isdir(filename
):
402 names
.append(filename
)
404 lst
.append( (dirname
, names
) )
407 os
.path
.walk(srcdir
, walk_helper
, (file_list
, wildcards
))
411 def makeLibName(name
):
412 if os
.name
== 'posix':
413 libname
= '%s_%s-%s' % (WXBASENAME
, name
, WXRELEASE
)
415 libname
= 'wxmsw%s%s_%s' % (WXDLLVER
, libFlag(), name
)
421 def adjustCFLAGS(cflags
, defines
, includes
):
422 '''Extrace the raw -I, -D, and -U flags and put them into
423 defines and includes as needed.'''
427 includes
.append(flag
[2:])
428 elif flag
[:2] == '-D':
430 if flag
.find('=') == -1:
431 defines
.append( (flag
, None) )
433 defines
.append( tuple(flag
.split('=')) )
434 elif flag
[:2] == '-U':
435 defines
.append( (flag
[2:], ) )
437 newCFLAGS
.append(flag
)
442 def adjustLFLAGS(lfags
, libdirs
, libs
):
443 '''Extrace the -L and -l flags and put them in libdirs and libs as needed'''
447 libdirs
.append(flag
[2:])
448 elif flag
[:2] == '-l':
449 libs
.append(flag
[2:])
451 newLFLAGS
.append(flag
)
455 #----------------------------------------------------------------------
474 if UNICODE
and WXPORT
not in ['msw', 'gtk2']:
475 raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT
478 #----------------------------------------------------------------------
479 # Setup some platform specific stuff
480 #----------------------------------------------------------------------
483 # Set compile flags and such for MSVC. These values are derived
484 # from the wxWidgets makefiles for MSVC, other compilers settings
485 # will probably vary...
486 if os
.environ
.has_key('WXWIN'):
487 WXDIR
= os
.environ
['WXWIN']
489 msg("WARNING: WXWIN not set in environment.")
490 WXDIR
= '..' # assumes in CVS tree
494 includes
= ['include', 'src',
495 opj(WXDIR
, 'lib', 'vc_dll', 'msw' + libFlag()),
496 opj(WXDIR
, 'include'),
497 opj(WXDIR
, 'contrib', 'include'),
500 defines
= [ ('WIN32', None),
506 ('SWIG_GLOBAL', None),
507 ('WXP_USE_THREAD', '1'),
511 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
514 defines
.append( ('__NO_VC_CRTDBG__', None) )
516 if not FINAL
or HYBRID
:
517 defines
.append( ('__WXDEBUG__', None) )
519 libdirs
= [ opj(WXDIR
, 'lib', 'vc_dll') ]
520 libs
= [ 'wxbase' + WXDLLVER
+ libFlag(), # TODO: trim this down to what is really needed for the core
521 'wxbase' + WXDLLVER
+ libFlag() + '_net',
522 'wxbase' + WXDLLVER
+ libFlag() + '_xml',
523 makeLibName('core')[0],
524 makeLibName('adv')[0],
525 makeLibName('html')[0],
528 libs
= libs
+ ['kernel32', 'user32', 'gdi32', 'comdlg32',
529 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32',
530 'odbc32', 'ole32', 'oleaut32', 'uuid', 'rpcrt4',
531 'advapi32', 'wsock32']
535 # '/GX-' # workaround for internal compiler error in MSVC on some machines
539 # Other MSVC flags...
540 # Too bad I don't remember why I was playing with these, can they be removed?
542 pass #cflags = cflags + ['/O1']
544 pass #cflags = cflags + ['/Ox']
546 pass # cflags = cflags + ['/Od', '/Z7']
547 # lflags = ['/DEBUG', ]
551 #----------------------------------------------------------------------
553 elif os
.name
== 'posix':
555 includes
= ['include', 'src']
556 defines
= [('SWIG_GLOBAL', None),
557 ('HAVE_CONFIG_H', None),
558 ('WXP_USE_THREAD', '1'),
561 defines
.append( ('NDEBUG',) ) # using a 1-tuple makes it do an undef
568 # If you get unresolved symbol errors on Solaris and are using gcc, then
569 # uncomment this block to add the right flags to the link step and build
571 ## if os.uname()[0] == 'SunOS':
572 ## libs.append('gcc')
573 ## libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
575 cflags
= os
.popen(WX_CONFIG
+ ' --cxxflags', 'r').read()[:-1]
576 cflags
= cflags
.split()
583 lflags
= os
.popen(WX_CONFIG
+ ' --libs', 'r').read()[:-1]
584 lflags
= lflags
.split()
586 WXBASENAME
= os
.popen(WX_CONFIG
+ ' --basename').read()[:-1]
587 WXRELEASE
= os
.popen(WX_CONFIG
+ ' --release').read()[:-1]
588 WXPREFIX
= os
.popen(WX_CONFIG
+ ' --prefix').read()[:-1]
591 if sys
.platform
[:6] == "darwin":
592 # Flags and such for a Darwin (Max OS X) build of Python
600 # Set flags for other Unix type platforms
605 portcfg
= os
.popen('gtk-config --cflags', 'r').read()[:-1]
606 elif WXPORT
== 'gtk2':
608 GENDIR
= 'gtk' # no code differences so use the same generated sources
609 portcfg
= os
.popen('pkg-config gtk+-2.0 --cflags', 'r').read()[:-1]
610 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
611 elif WXPORT
== 'x11':
614 BUILD_BASE
= BUILD_BASE
+ '-' + WXPORT
616 raise SystemExit, "Unknown WXPORT value: " + WXPORT
618 cflags
+= portcfg
.split()
620 # Some distros (e.g. Mandrake) put libGLU in /usr/X11R6/lib, but
621 # wx-config doesn't output that for some reason. For now, just
622 # add it unconditionally but we should really check if the lib is
623 # really found there or wx-config should be fixed.
624 libdirs
.append("/usr/X11R6/lib")
627 # Move the various -I, -D, etc. flags we got from the *config scripts
628 # into the distutils lists.
629 cflags
= adjustCFLAGS(cflags
, defines
, includes
)
630 lflags
= adjustLFLAGS(lflags
, libdirs
, libs
)
633 #----------------------------------------------------------------------
635 raise 'Sorry, platform not supported...'
638 #----------------------------------------------------------------------
639 # post platform setup checks and tweaks, create the full version string
640 #----------------------------------------------------------------------
643 BUILD_BASE
= BUILD_BASE
+ '.unicode'
647 VERSION
= "%s.%s.%s.%s%s" % (VER_MAJOR
, VER_MINOR
, VER_RELEASE
,
648 VER_SUBREL
, VER_FLAGS
)
650 #----------------------------------------------------------------------
651 # Update the version file
652 #----------------------------------------------------------------------
654 # Unconditionally updated since the version string can change based
655 # on the UNICODE flag
656 open('wx/__version__.py', 'w').write("""\
657 # This file was generated by setup.py...
659 VERSION_STRING = '%(VERSION)s'
660 MAJOR_VERSION = %(VER_MAJOR)s
661 MINOR_VERSION = %(VER_MINOR)s
662 RELEASE_VERSION = %(VER_RELEASE)s
663 SUBREL_VERSION = %(VER_SUBREL)s
665 VERSION = (MAJOR_VERSION, MINOR_VERSION, RELEASE_VERSION,
666 SUBREL_VERSION, '%(VER_FLAGS)s')
668 RELEASE_NUMBER = RELEASE_VERSION # for compatibility
671 CLEANUP
.append('wx/__version__.py')
675 #----------------------------------------------------------------------
677 #----------------------------------------------------------------------
695 swig_args
.append('-DwxUSE_UNICODE')
697 swig_deps
= [ 'src/my_typemaps.i',
702 depends
= [ #'include/wx/wxPython/wxPython.h',
703 #'include/wx/wxPython/wxPython_int.h',
708 #----------------------------------------------------------------------
709 # Define the CORE extension module
710 #----------------------------------------------------------------------
712 msg('Preparing CORE...')
713 swig_sources
= run_swig(['core.i'], 'src', GENDIR
, PKGDIR
,
714 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
718 'src/_constraints.i',
721 'src/_core_rename.i',
722 'src/_core_reverse.txt',
740 copy_file('src/__init__.py', PKGDIR
, update
=1, verbose
=0)
741 CLEANUP
.append(opj(PKGDIR
, '__init__.py'))
744 # update the license files
746 for file in ['preamble.txt', 'licence.txt', 'licendoc.txt', 'lgpl.txt']:
747 copy_file(opj(WXDIR
, 'docs', file), opj('licence',file), update
=1, verbose
=0)
748 CLEANUP
.append(opj('licence',file))
749 CLEANUP
.append('licence')
753 build_locale_dir(opj(PKGDIR
, 'locale'))
754 DATA_FILES
+= build_locale_list(opj(PKGDIR
, 'locale'))
758 rc_file
= ['src/wxc.rc']
763 ext
= Extension('_core', ['src/helpers.cpp',
765 ] + rc_file
+ swig_sources
,
767 include_dirs
= includes
,
768 define_macros
= defines
,
770 library_dirs
= libdirs
,
773 extra_compile_args
= cflags
,
774 extra_link_args
= lflags
,
778 wxpExtensions
.append(ext
)
784 # Extension for the GDI module
785 swig_sources
= run_swig(['gdi.i'], 'src', GENDIR
, PKGDIR
,
786 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
787 ['src/_gdi_rename.i',
805 ext
= Extension('_gdi', ['src/drawlist.cpp'] + swig_sources
,
806 include_dirs
= includes
,
807 define_macros
= defines
,
808 library_dirs
= libdirs
,
810 extra_compile_args
= cflags
,
811 extra_link_args
= lflags
,
814 wxpExtensions
.append(ext
)
821 # Extension for the windows module
822 swig_sources
= run_swig(['windows.i'], 'src', GENDIR
, PKGDIR
,
823 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
824 ['src/_windows_rename.i',
825 'src/_windows_reverse.txt',
840 ext
= Extension('_windows', swig_sources
,
841 include_dirs
= includes
,
842 define_macros
= defines
,
843 library_dirs
= libdirs
,
845 extra_compile_args
= cflags
,
846 extra_link_args
= lflags
,
849 wxpExtensions
.append(ext
)
854 # Extension for the controls module
855 swig_sources
= run_swig(['controls.i'], 'src', GENDIR
, PKGDIR
,
856 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
857 [ 'src/_controls_rename.i',
858 'src/_controls_reverse.txt',
881 ext
= Extension('_controls', swig_sources
,
882 include_dirs
= includes
,
883 define_macros
= defines
,
884 library_dirs
= libdirs
,
886 extra_compile_args
= cflags
,
887 extra_link_args
= lflags
,
890 wxpExtensions
.append(ext
)
895 # Extension for the misc module
896 swig_sources
= run_swig(['misc.i'], 'src', GENDIR
, PKGDIR
,
897 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
916 ext
= Extension('_misc', swig_sources
,
917 include_dirs
= includes
,
918 define_macros
= defines
,
919 library_dirs
= libdirs
,
921 extra_compile_args
= cflags
,
922 extra_link_args
= lflags
,
925 wxpExtensions
.append(ext
)
930 ## Core modules that are not in the "core" namespace start here
933 swig_sources
= run_swig(['calendar.i'], 'src', GENDIR
, PKGDIR
,
934 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
935 ext
= Extension('_calendar', swig_sources
,
936 include_dirs
= includes
,
937 define_macros
= defines
,
938 library_dirs
= libdirs
,
940 extra_compile_args
= cflags
,
941 extra_link_args
= lflags
,
944 wxpExtensions
.append(ext
)
947 swig_sources
= run_swig(['grid.i'], 'src', GENDIR
, PKGDIR
,
948 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
949 ext
= Extension('_grid', swig_sources
,
950 include_dirs
= includes
,
951 define_macros
= defines
,
952 library_dirs
= libdirs
,
954 extra_compile_args
= cflags
,
955 extra_link_args
= lflags
,
958 wxpExtensions
.append(ext
)
962 swig_sources
= run_swig(['html.i'], 'src', GENDIR
, PKGDIR
,
963 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
964 ext
= Extension('_html', swig_sources
,
965 include_dirs
= includes
,
966 define_macros
= defines
,
967 library_dirs
= libdirs
,
969 extra_compile_args
= cflags
,
970 extra_link_args
= lflags
,
973 wxpExtensions
.append(ext
)
977 swig_sources
= run_swig(['wizard.i'], 'src', GENDIR
, PKGDIR
,
978 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
979 ext
= Extension('_wizard', swig_sources
,
980 include_dirs
= includes
,
981 define_macros
= defines
,
982 library_dirs
= libdirs
,
984 extra_compile_args
= cflags
,
985 extra_link_args
= lflags
,
988 wxpExtensions
.append(ext
)
991 #----------------------------------------------------------------------
994 CONTRIBS_INC
= [ CONTRIBS_INC
]
999 #----------------------------------------------------------------------
1000 # Define the GLCanvas extension module
1001 #----------------------------------------------------------------------
1004 msg('Preparing GLCANVAS...')
1005 location
= 'contrib/glcanvas'
1007 swig_sources
= run_swig(['glcanvas.i'], location
, GENDIR
, PKGDIR
,
1008 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1011 if os
.name
== 'posix':
1012 gl_config
= os
.popen(WX_CONFIG
+ ' --gl-libs', 'r').read()[:-1]
1013 gl_lflags
= gl_config
.split() + lflags
1016 gl_libs
= libs
+ ['opengl32', 'glu32'] + makeLibName('gl')
1019 ext
= Extension('_glcanvas',
1022 include_dirs
= includes
+ CONTRIBS_INC
,
1023 define_macros
= defines
,
1025 library_dirs
= libdirs
,
1026 libraries
= gl_libs
,
1028 extra_compile_args
= cflags
,
1029 extra_link_args
= gl_lflags
,
1032 wxpExtensions
.append(ext
)
1035 #----------------------------------------------------------------------
1036 # Define the OGL extension module
1037 #----------------------------------------------------------------------
1040 msg('Preparing OGL...')
1041 location
= 'contrib/ogl'
1043 swig_sources
= run_swig(['ogl.i'], location
, GENDIR
, PKGDIR
,
1044 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
1045 [ '%s/_oglbasic.i' % location
,
1046 '%s/_oglshapes.i' % location
,
1047 '%s/_oglshapes2.i' % location
,
1048 '%s/_oglcanvas.i' % location
,
1049 '%s/_ogldefs.i' % location
,
1052 ext
= Extension('_ogl',
1055 include_dirs
= includes
+ [ location
] + CONTRIBS_INC
,
1056 define_macros
= defines
+ [('wxUSE_DEPRECATED', '0')],
1058 library_dirs
= libdirs
,
1059 libraries
= libs
+ makeLibName('ogl'),
1061 extra_compile_args
= cflags
,
1062 extra_link_args
= lflags
,
1065 wxpExtensions
.append(ext
)
1069 #----------------------------------------------------------------------
1070 # Define the STC extension module
1071 #----------------------------------------------------------------------
1074 msg('Preparing STC...')
1075 location
= 'contrib/stc'
1077 STC_H
= opj(WXDIR
, 'contrib', 'include/wx/stc')
1079 STC_H
= opj(WXPREFIX
, 'include/wx/stc')
1081 ## NOTE: need to add something like this to the stc.bkl...
1083 ## # Check if gen_iface needs to be run for the wxSTC sources
1084 ## if (newer(opj(CTRB_SRC, 'stc/stc.h.in'), opj(CTRB_INC, 'stc/stc.h' )) or
1085 ## newer(opj(CTRB_SRC, 'stc/stc.cpp.in'), opj(CTRB_SRC, 'stc/stc.cpp')) or
1086 ## newer(opj(CTRB_SRC, 'stc/gen_iface.py'), opj(CTRB_SRC, 'stc/stc.cpp'))):
1088 ## msg('Running gen_iface.py, regenerating stc.h and stc.cpp...')
1089 ## cwd = os.getcwd()
1090 ## os.chdir(opj(CTRB_SRC, 'stc'))
1091 ## sys.path.insert(0, os.curdir)
1093 ## gen_iface.main([])
1097 swig_sources
= run_swig(['stc.i'], location
, '', PKGDIR
,
1098 USE_SWIG
, swig_force
,
1099 swig_args
+ ['-I'+STC_H
, '-I'+location
],
1100 [opj(STC_H
, 'stc.h')] + swig_deps
)
1102 ext
= Extension('_stc',
1105 include_dirs
= includes
+ CONTRIBS_INC
,
1106 define_macros
= defines
,
1108 library_dirs
= libdirs
,
1109 libraries
= libs
+ makeLibName('stc'),
1111 extra_compile_args
= cflags
,
1112 extra_link_args
= lflags
,
1115 wxpExtensions
.append(ext
)
1119 #----------------------------------------------------------------------
1120 # Define the IEWIN extension module (experimental)
1121 #----------------------------------------------------------------------
1124 msg('Preparing IEWIN...')
1125 location
= 'contrib/iewin'
1127 swig_files
= ['iewin.i', ]
1129 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1130 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1133 ext
= Extension('_iewin', ['%s/IEHtmlWin.cpp' % location
,
1134 '%s/wxactivex.cpp' % location
,
1137 include_dirs
= includes
+ CONTRIBS_INC
,
1138 define_macros
= defines
,
1140 library_dirs
= libdirs
,
1143 extra_compile_args
= cflags
,
1144 extra_link_args
= lflags
,
1147 wxpExtensions
.append(ext
)
1150 #----------------------------------------------------------------------
1151 # Define the XRC extension module
1152 #----------------------------------------------------------------------
1155 msg('Preparing XRC...')
1156 location
= 'contrib/xrc'
1158 swig_sources
= run_swig(['xrc.i'], location
, '', PKGDIR
,
1159 USE_SWIG
, swig_force
, swig_args
, swig_deps
+
1160 [ '%s/_xrc_rename.i' % location
,
1161 '%s/_xrc_ex.py' % location
,
1162 '%s/_xmlres.i' % location
,
1163 '%s/_xmlsub.i' % location
,
1164 '%s/_xml.i' % location
,
1165 '%s/_xmlhandler.i' % location
,
1168 ext
= Extension('_xrc',
1171 include_dirs
= includes
+ CONTRIBS_INC
,
1172 define_macros
= defines
,
1174 library_dirs
= libdirs
,
1175 libraries
= libs
+ makeLibName('xrc'),
1177 extra_compile_args
= cflags
,
1178 extra_link_args
= lflags
,
1181 wxpExtensions
.append(ext
)
1185 #----------------------------------------------------------------------
1186 # Define the GIZMOS extension module
1187 #----------------------------------------------------------------------
1190 msg('Preparing GIZMOS...')
1191 location
= 'contrib/gizmos'
1193 swig_sources
= run_swig(['gizmos.i'], location
, GENDIR
, PKGDIR
,
1194 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1196 ext
= Extension('_gizmos',
1197 [ '%s/treelistctrl.cpp' % location
] + swig_sources
,
1199 include_dirs
= includes
+ [ location
] + CONTRIBS_INC
,
1200 define_macros
= defines
,
1202 library_dirs
= libdirs
,
1203 libraries
= libs
+ makeLibName('gizmos'),
1205 extra_compile_args
= cflags
,
1206 extra_link_args
= lflags
,
1209 wxpExtensions
.append(ext
)
1213 #----------------------------------------------------------------------
1214 # Define the DLLWIDGET extension module
1215 #----------------------------------------------------------------------
1218 msg('Preparing DLLWIDGET...')
1219 location
= 'contrib/dllwidget'
1220 swig_files
= ['dllwidget_.i']
1222 swig_sources
= run_swig(swig_files
, location
, '', PKGDIR
,
1223 USE_SWIG
, swig_force
, swig_args
, swig_deps
)
1225 # copy a contrib project specific py module to the main package dir
1226 copy_file(opj(location
, 'dllwidget.py'), PKGDIR
, update
=1, verbose
=0)
1227 CLEANUP
.append(opj(PKGDIR
, 'dllwidget.py'))
1229 ext
= Extension('dllwidget_c', [
1230 '%s/dllwidget.cpp' % location
,
1233 include_dirs
= includes
+ CONTRIBS_INC
,
1234 define_macros
= defines
,
1236 library_dirs
= libdirs
,
1239 extra_compile_args
= cflags
,
1240 extra_link_args
= lflags
,
1243 wxpExtensions
.append(ext
)
1248 #----------------------------------------------------------------------
1250 #----------------------------------------------------------------------
1255 SCRIPTS
= [opj('scripts/helpviewer'),
1256 opj('scripts/img2png'),
1257 opj('scripts/img2xpm'),
1258 opj('scripts/img2py'),
1259 opj('scripts/xrced'),
1260 opj('scripts/pyshell'),
1261 opj('scripts/pycrust'),
1262 opj('scripts/pywrap'),
1263 opj('scripts/pywrap'),
1264 opj('scripts/pyalacarte'),
1265 opj('scripts/pyalamode'),
1269 DATA_FILES
+= find_data_files('wx/tools/XRCed', '*.txt', '*.xrc')
1270 DATA_FILES
+= find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html')
1271 DATA_FILES
+= find_data_files('wx', '*.txt', '*.css', '*.html')
1274 #----------------------------------------------------------------------
1275 # Do the Setup/Build/Install/Whatever
1276 #----------------------------------------------------------------------
1278 if __name__
== "__main__":
1280 setup(name
= 'wxPython',
1282 description
= DESCRIPTION
,
1283 long_description
= LONG_DESCRIPTION
,
1285 author_email
= AUTHOR_EMAIL
,
1287 download_url
= DOWNLOAD_URL
,
1289 platforms
= PLATFORMS
,
1290 classifiers
= filter(None, CLASSIFIERS
.split("\n")),
1291 keywords
= KEYWORDS
,
1293 packages
= ['wxPython',
1295 'wxPython.lib.colourchooser',
1296 'wxPython.lib.editor',
1297 'wxPython.lib.mixins',
1302 'wx.lib.colourchooser',
1310 ext_package
= PKGDIR
,
1311 ext_modules
= wxpExtensions
,
1313 options
= { 'build' : { 'build_base' : BUILD_BASE }
},
1317 cmdclass
= { 'install_data': smart_install_data
,
1318 'clean': extra_clean
,
1320 data_files
= DATA_FILES
,
1325 #----------------------------------------------------------------------
1326 #----------------------------------------------------------------------