]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/setup.py
Copy Solaris note from 2.4's setup.py
[wxWidgets.git] / wxPython / setup.py
index 4f41f3115e35c95b2629da87fcdc2e244b2fd8be..0c42993d779cb83341d44dcc1f8e4ac2202661d0 100755 (executable)
@@ -1,7 +1,7 @@
 #!/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
@@ -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        = "p6"   # release flags, such as prerelease num, unicode, etc.
 
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
@@ -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
+cleaning = 'clean' in sys.argv
+
 
 # change the PORT default for wxMac
 if sys.platform[:6] == "darwin":
@@ -244,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:
@@ -251,10 +256,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')
+        xml_file = os.path.join("docs", "xml-raw", basefile+'_swig.xml')
 
         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
@@ -266,16 +272,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:
-                    # 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',
-                            './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)
+                    os.remove(xmltemp)
 
                 # 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)
 
@@ -501,6 +519,13 @@ elif os.name == 'posix':
     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:
@@ -619,7 +644,7 @@ swig_args = ['-c++',
 
              '-I./src',
              '-D'+WXPLAT,
-             '-c'
+             '-noruntime'
              ]
 if UNICODE:
     swig_args.append('-DwxUSE_UNICODE')
@@ -642,7 +667,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',
@@ -717,7 +743,7 @@ swig_sources = run_swig(['gdi.i'], 'src', GENDIR, PKGDIR,
                          'src/_gdiobj.i',           'src/_icon.i',
                          'src/_imaglist.i',         'src/_pen.i',
                          'src/_region.i',           'src/_palette.i',
-                         'src/_stockobjs.i',        'src/_dragimg.i',
+                         'src/_stockobjs.i',        
                          'src/_effects.i',
                           'src/_intl.i',
                           'src/_intl_ex.py',
@@ -743,7 +769,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',
@@ -779,7 +804,7 @@ swig_sources = run_swig(['controls.i'], 'src', GENDIR, PKGDIR,
                           'src/_tglbtn.i',              'src/_notebook.i',
                           'src/_listctrl.i',            'src/_treectrl.i',
                           'src/_dirctrl.i',             'src/_pycontrol.i',
-                          'src/_cshelp.i',
+                          'src/_cshelp.i',              'src/_dragimg.i',
                           ])
 ext = Extension('_controls', swig_sources,
                 include_dirs =  includes,
@@ -930,7 +955,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,
@@ -942,7 +967,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,
@@ -1080,13 +1105,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,