]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/setup.py
Script updates
[wxWidgets.git] / wxPython / setup.py
index c2e90d82f3e89e76ee720eeb4c7611ec53eb3a90..31cbb64d1ae36365b111b2d661edf6c390fd2130 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 #----------------------------------------------------------------------
 
 #!/usr/bin/env python
 #----------------------------------------------------------------------
 
-import sys, os, glob, fnmatch
+import sys, os, glob, fnmatch, tempfile
 from distutils.core      import setup, Extension
 from distutils.file_util import copy_file
 from distutils.dir_util  import mkpath
 from distutils.core      import setup, Extension
 from distutils.file_util import copy_file
 from distutils.dir_util  import mkpath
@@ -17,7 +17,7 @@ VER_MAJOR        = 2      # The first three must match wxWindows
 VER_MINOR        = 5
 VER_RELEASE      = 1
 VER_SUBREL       = 0      # wxPython release num for x.y.z release of wxWindows
 VER_MINOR        = 5
 VER_RELEASE      = 1
 VER_SUBREL       = 0      # wxPython release num for x.y.z release of wxWindows
-VER_FLAGS        = "p3"   # release flags, such as prerelease num, unicode, etc.
+VER_FLAGS        = "p8"   # release flags, such as prerelease num, unicode, etc.
 
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
 
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
@@ -64,7 +64,7 @@ BUILD_DLLWIDGET = 0# Build a module that enables unknown wx widgets
                    # to be loaded from a DLL and to be used from Python.
 
                    # Internet Explorer wrapper (experimental)
                    # to be loaded from a DLL and to be used from Python.
 
                    # Internet Explorer wrapper (experimental)
-BUILD_IEWIN = 0 #(os.name == 'nt')
+BUILD_IEWIN = (os.name == 'nt')
 
 
 CORE_ONLY = 0      # if true, don't build any of the above
 
 
 CORE_ONLY = 0      # if true, don't build any of the above
@@ -160,6 +160,8 @@ DATA_FILES = []
 
 force = '--force' in sys.argv or '-f' in sys.argv
 debug = '--debug' in sys.argv or '-g' in sys.argv
 
 force = '--force' in sys.argv or '-f' in sys.argv
 debug = '--debug' in sys.argv or '-g' in sys.argv
+cleaning = 'clean' in sys.argv
+
 
 # change the PORT default for wxMac
 if sys.platform[:6] == "darwin":
 
 # change the PORT default for wxMac
 if sys.platform[:6] == "darwin":
@@ -221,7 +223,10 @@ def Verify_WX_CONFIG():
         else:
             uf = ''
         ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR)
         else:
             uf = ''
         ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR)
-        WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2)
+        port = WXPORT
+        if port == "x11":
+            port = "x11univ"
+        WX_CONFIG = 'wx%s%s%s-%s-config' % (port, uf, df, ver2)
 
         searchpath = os.environ["PATH"]
         for p in searchpath.split(':'):
 
         searchpath = os.environ["PATH"]
         for p in searchpath.split(':'):
@@ -244,6 +249,9 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
     if not os.path.exists(os.path.join(dir, gendir)):
         os.mkdir(os.path.join(dir, gendir))
 
     if not os.path.exists(os.path.join(dir, gendir)):
         os.mkdir(os.path.join(dir, gendir))
 
+    if not os.path.exists(os.path.join("docs", "xml-raw")):
+        os.mkdir(os.path.join("docs", "xml-raw"))
+
     sources = []
 
     for file in files:
     sources = []
 
     for file in files:
@@ -251,10 +259,11 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
         i_file   = os.path.join(dir, file)
         py_file  = os.path.join(dir, gendir, basefile+'.py')
         cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp')
         i_file   = os.path.join(dir, file)
         py_file  = os.path.join(dir, gendir, basefile+'.py')
         cpp_file = os.path.join(dir, gendir, basefile+'_wrap.cpp')
+        xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
 
         sources.append(cpp_file)
 
 
         sources.append(cpp_file)
 
-        if USE_SWIG:
+        if not cleaning and USE_SWIG:
             for dep in swig_deps:
                 if newer(dep, py_file) or newer(dep, cpp_file):
                     force = 1
             for dep in swig_deps:
                 if newer(dep, py_file) or newer(dep, cpp_file):
                     force = 1
@@ -266,16 +275,28 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, swig_deps=
                 #i_file = opj(i_file)     #'/'.join(i_file.split('\\'))
 
                 if BUILD_RENAMERS:
                 #i_file = opj(i_file)     #'/'.join(i_file.split('\\'))
 
                 if BUILD_RENAMERS:
-                    # first run build_renamers
+                    #tempfile.tempdir = sourcePath
+                    xmltemp = tempfile.mktemp('.xml')
+                    
+                    # First run swig to produce the XML file, adding
+                    # an extra -D that prevents the old rename
+                    # directives from being used
+                    cmd = [ swig_cmd ] + swig_args + \
+                          [ '-DBUILDING_RENAMERS', '-xmlout', xmltemp ] + \
+                          ['-I'+dir, '-o', cpp_file, i_file]
+                    msg(' '.join(cmd))
+                    spawn(cmd)
+
+                    # Next run build_renamers to process the XML
                     cmd = [ sys.executable, '-u',
                     cmd = [ sys.executable, '-u',
-                            './distrib/build_renamers.py',
-                            i_file, '-D'+WXPLAT, ] + \
-                            [x for x in swig_args if x.startswith('-I')]
+                            './distrib/build_renamers.py', dir, basefile, xmltemp] 
                     msg(' '.join(cmd))
                     spawn(cmd)
                     msg(' '.join(cmd))
                     spawn(cmd)
+                    os.remove(xmltemp)
 
                 # Then run swig for real
 
                 # Then run swig for real
-                cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, i_file]
+                cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file,
+                                                  '-xmlout', xml_file, i_file]
                 msg(' '.join(cmd))
                 spawn(cmd)
 
                 msg(' '.join(cmd))
                 spawn(cmd)
 
@@ -448,6 +469,8 @@ if os.name == 'nt':
     if UNDEF_NDEBUG:
         defines.append( ('NDEBUG',) )  # using a 1-tuple makes it do an undef
 
     if UNDEF_NDEBUG:
         defines.append( ('NDEBUG',) )  # using a 1-tuple makes it do an undef
 
+    if HYBRID:
+        defines.append( ('__NO_VC_CRTDBG__', None) )
 
     if not FINAL or HYBRID:
         defines.append( ('__WXDEBUG__', None) )
 
     if not FINAL or HYBRID:
         defines.append( ('__WXDEBUG__', None) )
@@ -501,6 +524,13 @@ elif os.name == 'posix':
     libdirs = []
     libs = []
 
     libdirs = []
     libs = []
 
+    # If you get unresolved symbol errors on Solaris and are using gcc, then
+    # uncomment this block to add the right flags to the link step and build
+    # again.
+    ## if os.uname()[0] == 'SunOS':
+    ##     libs.append('gcc')
+    ##     libdirs.append(commands.getoutput("gcc -print-search-dirs | grep '^install' | awk '{print $2}'")[:-1])
+
     cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
     cflags = cflags.split()
     if debug:
     cflags = os.popen(WX_CONFIG + ' --cxxflags', 'r').read()[:-1]
     cflags = cflags.split()
     if debug:
@@ -619,7 +649,7 @@ swig_args = ['-c++',
 
              '-I./src',
              '-D'+WXPLAT,
 
              '-I./src',
              '-D'+WXPLAT,
-             '-c'
+             '-noruntime'
              ]
 if UNICODE:
     swig_args.append('-DwxUSE_UNICODE')
              ]
 if UNICODE:
     swig_args.append('-DwxUSE_UNICODE')
@@ -642,7 +672,8 @@ depends = [ #'include/wx/wxPython/wxPython.h',
 msg('Preparing CORE...')
 swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR,
                         USE_SWIG, swig_force, swig_args, swig_deps +
 msg('Preparing CORE...')
 swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR,
                         USE_SWIG, swig_force, swig_args, swig_deps +
-                        [ 'src/_app.i',
+                        [ 'src/_accel.i',
+                          'src/_app.i',
                           'src/_app_ex.py',
                           'src/_constraints.i',
                           'src/_core_api.i',
                           'src/_app_ex.py',
                           'src/_constraints.i',
                           'src/_core_api.i',
@@ -663,6 +694,7 @@ swig_sources = run_swig(['core.i'], 'src', GENDIR, PKGDIR,
                           'src/_streams.i',
                           'src/_validator.i',
                           'src/_window.i',
                           'src/_streams.i',
                           'src/_validator.i',
                           'src/_window.i',
+                          'src/_control.i',  
                           ])
 
 copy_file('src/__init__.py', PKGDIR, update=1, verbose=0)
                           ])
 
 copy_file('src/__init__.py', PKGDIR, update=1, verbose=0)
@@ -743,7 +775,6 @@ swig_sources = run_swig(['windows.i'], 'src', GENDIR, PKGDIR,
                         USE_SWIG, swig_force, swig_args, swig_deps +
                         ['src/_windows_rename.i',    'src/_windows_reverse.txt',
                          'src/_panel.i',
                         USE_SWIG, swig_force, swig_args, swig_deps +
                         ['src/_windows_rename.i',    'src/_windows_reverse.txt',
                          'src/_panel.i',
-                         'src/_accel.i',
                          'src/_toplvl.i',            'src/_statusbar.i',
                          'src/_splitter.i',          'src/_sashwin.i',
                          'src/_popupwin.i',          'src/_tipwin.i',
                          'src/_toplvl.i',            'src/_statusbar.i',
                          'src/_splitter.i',          'src/_sashwin.i',
                          'src/_popupwin.i',          'src/_tipwin.i',
@@ -769,7 +800,7 @@ wxpExtensions.append(ext)
 swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR,
                         USE_SWIG, swig_force, swig_args, swig_deps +
                         [ 'src/_controls_rename.i',     'src/_controls_reverse.txt',
 swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR,
                         USE_SWIG, swig_force, swig_args, swig_deps +
                         [ 'src/_controls_rename.i',     'src/_controls_reverse.txt',
-                          'src/_control.i',             'src/_toolbar.i',
+                          'src/_toolbar.i',
                           'src/_button.i',              'src/_checkbox.i',
                           'src/_choice.i',              'src/_combobox.i',
                           'src/_gauge.i',               'src/_statctrls.i',
                           'src/_button.i',              'src/_checkbox.i',
                           'src/_choice.i',              'src/_combobox.i',
                           'src/_gauge.i',               'src/_statctrls.i',
@@ -802,7 +833,7 @@ swig_sources = run_swig(['misc.i'], 'src', GENDIR, PKGDIR,
                           'src/_misc.i',          'src/_tipdlg.i',
                           'src/_timer.i',         'src/_log.i',
                           'src/_process.i',       'src/_joystick.i',
                           'src/_misc.i',          'src/_tipdlg.i',
                           'src/_timer.i',         'src/_log.i',
                           'src/_process.i',       'src/_joystick.i',
-                          'src/_wave.i',          'src/_mimetype.i',
+                          'src/_sound.i',         'src/_mimetype.i',
                           'src/_artprov.i',       'src/_config.i',
                           'src/_datetime.i',      'src/_dataobj.i',
                           'src/_dnd.i',
                           'src/_artprov.i',       'src/_config.i',
                           'src/_datetime.i',      'src/_dataobj.i',
                           'src/_dnd.i',
@@ -930,7 +961,7 @@ if BUILD_OGL:
     msg('Preparing OGL...')
     location = 'contrib/ogl'
 
     msg('Preparing OGL...')
     location = 'contrib/ogl'
 
-    swig_sources = run_swig(['ogl.i'], location, '', PKGDIR,
+    swig_sources = run_swig(['ogl.i'], location, GENDIR, PKGDIR,
                             USE_SWIG, swig_force, swig_args, swig_deps +
                             [ '%s/_oglbasic.i' % location,
                               '%s/_oglshapes.i' % location,
                             USE_SWIG, swig_force, swig_args, swig_deps +
                             [ '%s/_oglbasic.i' % location,
                               '%s/_oglshapes.i' % location,
@@ -942,7 +973,7 @@ if BUILD_OGL:
     ext = Extension('_ogl',
                     swig_sources,
 
     ext = Extension('_ogl',
                     swig_sources,
 
-                    include_dirs =  includes,
+                    include_dirs =  includes + [ location ],
                     define_macros = defines + [('wxUSE_DEPRECATED', '0')],
 
                     library_dirs = libdirs,
                     define_macros = defines + [('wxUSE_DEPRECATED', '0')],
 
                     library_dirs = libdirs,
@@ -968,7 +999,7 @@ if BUILD_STC:
     else:
         STC_H = opj(WXPREFIX, 'include/wx/stc')
 
     else:
         STC_H = opj(WXPREFIX, 'include/wx/stc')
 
-## NOTE: need to add this to the stc.bkl...
+## NOTE: need to add something like this to the stc.bkl...
 
 ##         # Check if gen_iface needs to be run for the wxSTC sources
 ##         if (newer(opj(CTRB_SRC, 'stc/stc.h.in'),     opj(CTRB_INC, 'stc/stc.h'  )) or
 
 ##         # Check if gen_iface needs to be run for the wxSTC sources
 ##         if (newer(opj(CTRB_SRC, 'stc/stc.h.in'),     opj(CTRB_INC, 'stc/stc.h'  )) or
@@ -1020,7 +1051,7 @@ if BUILD_IEWIN:
                             USE_SWIG, swig_force, swig_args, swig_deps)
 
 
                             USE_SWIG, swig_force, swig_args, swig_deps)
 
 
-    ext = Extension('iewinc', ['%s/IEHtmlWin.cpp' % location,
+    ext = Extension('_iewin', ['%s/IEHtmlWin.cpp' % location,
                                '%s/wxactivex.cpp' % location,
                              ] + swig_sources,
 
                                '%s/wxactivex.cpp' % location,
                              ] + swig_sources,
 
@@ -1080,13 +1111,13 @@ if BUILD_GIZMOS:
     msg('Preparing GIZMOS...')
     location = 'contrib/gizmos'
 
     msg('Preparing GIZMOS...')
     location = 'contrib/gizmos'
 
-    swig_sources = run_swig(['gizmos.i'], location, '', PKGDIR,
+    swig_sources = run_swig(['gizmos.i'], location, GENDIR, PKGDIR,
                             USE_SWIG, swig_force, swig_args, swig_deps)
 
     ext = Extension('_gizmos',
                     [ '%s/treelistctrl.cpp' % location ] + swig_sources,
 
                             USE_SWIG, swig_force, swig_args, swig_deps)
 
     ext = Extension('_gizmos',
                     [ '%s/treelistctrl.cpp' % location ] + swig_sources,
 
-                    include_dirs =  includes,
+                    include_dirs =  includes + [ location ],
                     define_macros = defines,
 
                     library_dirs = libdirs,
                     define_macros = defines,
 
                     library_dirs = libdirs,
@@ -1155,8 +1186,8 @@ else:
                ]
 
 
                ]
 
 
-DATA_FILES += find_data_files('wxPython/tools/XRCed', '*.txt', '*.xrc')
-DATA_FILES += find_data_files('wxPython/py', '*.txt', '*.ico', '*.css', '*.html')
+DATA_FILES += find_data_files('wx/tools/XRCed', '*.txt', '*.xrc')
+DATA_FILES += find_data_files('wx/py', '*.txt', '*.ico', '*.css', '*.html')
 DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html')
 
 
 DATA_FILES += find_data_files('wx', '*.txt', '*.css', '*.html')
 
 
@@ -1192,7 +1223,6 @@ if __name__ == "__main__":
                           'wx.lib.editor',
                           'wx.lib.mixins',
                           'wx.py',
                           'wx.lib.editor',
                           'wx.lib.mixins',
                           'wx.py',
-                          'wx.py.wxd',
                           'wx.tools',
                           'wx.tools.XRCed',
                           ],
                           'wx.tools',
                           'wx.tools.XRCed',
                           ],