]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/setup.py
reSWIGged
[wxWidgets.git] / wxPython / setup.py
index d5ed5ec7b02398ee94c3bf3923cffe1071ec831f..ba32bc46af702fb570c1fae2cc5e856dc23dcc5d 100755 (executable)
@@ -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_FLAGS        = "p3"   # release flags, such as prerelease num, unicode, etc.
+VER_FLAGS        = "p4"   # release flags, such as prerelease num, unicode, etc.
 
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
@@ -246,6 +246,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("docs", "xml-raw")):
+        os.mkdir(os.path.join("docs", "xml-raw"))
+
     sources = []
 
     for file in files:
@@ -253,6 +256,7 @@ 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')
+        xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
 
         sources.append(cpp_file)
 
@@ -268,13 +272,27 @@ 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:
-                    # first run build_renamers
+                    #info_file = "./distrib/swig_info"
+                    #info_dict = { 'cmd'  : swig_cmd,
+                    #              'args' : swig_args +  ['-I'+dir]
+                    #              }
+                    #open(info_file, "w").write(str(args_dict))
+
+                    # 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', xml_file ] + \
+                          ['-I'+dir, '-o', cpp_file, i_file]
+                    msg(' '.join(cmd))
+                    spawn(cmd)
+
+                    # Next run build_renamers to process the XML
                     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, xml_file] 
                     msg(' '.join(cmd))
                     spawn(cmd)
+                    #os.remove(info_file)
 
                 # Then run swig for real
                 cmd = [ swig_cmd ] + swig_args + ['-I'+dir, '-o', cpp_file, i_file]
@@ -621,7 +639,7 @@ swig_args = ['-c++',
 
              '-I./src',
              '-D'+WXPLAT,
-             '-c'
+             '-noruntime'
              ]
 if UNICODE:
     swig_args.append('-DwxUSE_UNICODE')
@@ -644,7 +662,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 +
-                        [ 'src/_app.i',
+                        [ 'src/_accel.i',
+                          'src/_app.i',
                           'src/_app_ex.py',
                           'src/_constraints.i',
                           'src/_core_api.i',
@@ -745,7 +764,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',
-                         'src/_accel.i',
                          'src/_toplvl.i',            'src/_statusbar.i',
                          'src/_splitter.i',          'src/_sashwin.i',
                          'src/_popupwin.i',          'src/_tipwin.i',
@@ -932,7 +950,7 @@ if BUILD_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,
@@ -944,7 +962,7 @@ if BUILD_OGL:
     ext = Extension('_ogl',
                     swig_sources,
 
-                    include_dirs =  includes,
+                    include_dirs =  includes + [ location ],
                     define_macros = defines + [('wxUSE_DEPRECATED', '0')],
 
                     library_dirs = libdirs,
@@ -1082,13 +1100,13 @@ if BUILD_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,
 
-                    include_dirs =  includes,
+                    include_dirs =  includes + [ location ],
                     define_macros = defines,
 
                     library_dirs = libdirs,