]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/setup.py
Added headers that didn't get installed.
[wxWidgets.git] / wxPython / setup.py
index e8dedd03f441f2ce4a96ce18fce328488a3c4ee0..dc52ba0d25140c9a38dba6a5d115fd01e57f14ac 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 #----------------------------------------------------------------------
 
-import sys, os, glob
+import sys, os, glob, fnmatch
 from distutils.core      import setup, Extension
 from distutils.file_util import copy_file
 from distutils.dir_util  import mkpath
@@ -13,7 +13,12 @@ from distutils.command.install_data import install_data
 # flags and values that affect this script
 #----------------------------------------------------------------------
 
-VERSION          = "2.5.0p1"
+VER_MAJOR        = 2      # The first three must match wxWindows
+VER_MINOR        = 5
+VER_RELEASE      = 0
+VER_SUBREL       = 0      # wxPython release num for x.y.z release of wxWindows
+VER_FLAGS        = "p1"   # release flags, such as prerelease num, unicode, etc.
+
 DESCRIPTION      = "Cross platform GUI toolkit for Python"
 AUTHOR           = "Robin Dunn"
 AUTHOR_EMAIL     = "Robin Dunn <robin@alldunn.com>"
@@ -201,7 +206,7 @@ def Verify_WX_CONFIG():
             uf = 'u'
         else:
             uf = ''
-        ver2 = VERSION[:3]
+        ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR)
         WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2)
 
         searchpath = os.environ["PATH"]
@@ -295,6 +300,24 @@ def build_locale_list(srcdir):
     return file_list
 
 
+def find_data_files(srcdir, *wildcards):
+    # get a list of all files under the srcdir matching wildcards,
+    # returned in a format to be used for install_data
+
+    def walk_helper(arg, dirname, files):
+        names = []
+        lst, wildcards = arg
+        for wc in wildcards:
+            for f in files:
+                filename = opj(dirname, f)
+                if fnmatch.fnmatch(filename, wc) and not os.path.isdir(filename):
+                    names.append(filename)
+        if names:
+            lst.append( (dirname, names ) )
+
+    file_list = []
+    os.path.walk(srcdir, walk_helper, (file_list, wildcards))
+    return file_list
 
 
 
@@ -381,7 +404,7 @@ if os.name == 'nt':
     lflags = None
 
     # Other MSVC flags...
-    # To bad I don't remember why I was playing with these, can they be removed?
+    # Too bad I don't remember why I was playing with these, can they be removed?
     if FINAL:
         pass #cflags = cflags + ['/O1']
     elif HYBRID :
@@ -482,22 +505,38 @@ else:
 
 
 #----------------------------------------------------------------------
-# post platform setup checks and tweaks
+# post platform setup checks and tweaks, create the full version string
 #----------------------------------------------------------------------
 
 if UNICODE:
     BUILD_BASE = BUILD_BASE + '.unicode'
-    VERSION = VERSION + 'u'
+    VER_FLAGS += 'u'
 
 
+VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE,
+                             VER_SUBREL, VER_FLAGS)
+
 #----------------------------------------------------------------------
-# Check if the version file needs updated
+# Update the version file
 #----------------------------------------------------------------------
 
-##if IN_CVS_TREE and newer('setup.py', 'src/__version__.py'):
+# Unconditionally updated since the version string can change based
+# on the UNICODE flag
+open('src/__version__.py', 'w').write("""\
+# This file was generated by setup.py...
+
+wxVERSION_STRING  = '%(VERSION)s'
+wxMAJOR_VERSION   = %(VER_MAJOR)s
+wxMINOR_VERSION   = %(VER_MINOR)s
+wxRELEASE_VERSION = %(VER_RELEASE)s
+wxSUBREL_VERSION  = %(VER_SUBREL)s
+
+wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION,
+             wxSUBREL_VERSION, '%(VER_FLAGS)s')
+
+wxRELEASE_NUMBER = wxRELEASE_VERSION  # for compatibility
+""" % globals())
 
-# Always do it since the version string can change based on the UNICODE flag
-open('src/__version__.py', 'w').write("ver = '%s'\n" % VERSION)
 
 
 
@@ -787,7 +826,11 @@ if BUILD_STC:
 
 
     ext = Extension('stc_c',
-                    ['%s/scintilla/src/AutoComplete.cxx' % STCLOC,
+                    ['%s/PlatWX.cpp' % STCLOC,
+                     '%s/ScintillaWX.cpp' % STCLOC,
+                     '%s/stc.cpp' % STCLOC,
+
+                     '%s/scintilla/src/AutoComplete.cxx' % STCLOC,
                      '%s/scintilla/src/CallTip.cxx' % STCLOC,
                      '%s/scintilla/src/CellBuffer.cxx' % STCLOC,
                      '%s/scintilla/src/ContractionState.cxx' % STCLOC,
@@ -806,31 +849,10 @@ if BUILD_STC:
                      '%s/scintilla/src/UniConversion.cxx' % STCLOC,
                      '%s/scintilla/src/ViewStyle.cxx' % STCLOC,
                      '%s/scintilla/src/WindowAccessor.cxx' % STCLOC,
-
-                     '%s/scintilla/src/LexAda.cxx' % STCLOC,
-                     '%s/scintilla/src/LexAVE.cxx' % STCLOC,
-                     '%s/scintilla/src/LexBaan.cxx' % STCLOC,
-                     '%s/scintilla/src/LexBullant.cxx' % STCLOC,
-                     '%s/scintilla/src/LexCPP.cxx' % STCLOC,
-                     '%s/scintilla/src/LexConf.cxx' % STCLOC,
-                     '%s/scintilla/src/LexCrontab.cxx' % STCLOC,
-                     '%s/scintilla/src/LexEiffel.cxx' % STCLOC,
-                     '%s/scintilla/src/LexHTML.cxx' % STCLOC,
-                     '%s/scintilla/src/LexLisp.cxx' % STCLOC,
-                     '%s/scintilla/src/LexLua.cxx' % STCLOC,
-                     '%s/scintilla/src/LexMatlab.cxx' % STCLOC,
-                     '%s/scintilla/src/LexOthers.cxx' % STCLOC,
-                     '%s/scintilla/src/LexPascal.cxx' % STCLOC,
-                     '%s/scintilla/src/LexPerl.cxx' % STCLOC,
-                     '%s/scintilla/src/LexPython.cxx' % STCLOC,
-                     '%s/scintilla/src/LexRuby.cxx' % STCLOC,
-                     '%s/scintilla/src/LexSQL.cxx' % STCLOC,
-                     '%s/scintilla/src/LexVB.cxx' % STCLOC,
-
-                     '%s/PlatWX.cpp' % STCLOC,
-                     '%s/ScintillaWX.cpp' % STCLOC,
-                     '%s/stc.cpp' % STCLOC,
-                     ] + swig_sources,
+                     '%s/scintilla/src/XPM.cxx' % STCLOC,
+                     ]
+                    + glob.glob('%s/scintilla/src/Lex*.cxx' % STCLOC)
+                    + swig_sources,
 
                     include_dirs = stc_includes,
                     define_macros = stc_defines,
@@ -903,54 +925,17 @@ if BUILD_XRC:
         contrib_copy_tree(opj(CTRB_INC, 'xrc'), opj(XMLINC, 'wx/xrc'))
         contrib_copy_tree(opj(CTRB_SRC, 'xrc'), XMLLOC)
 
-    ext = Extension('xrcc', ['%s/expat/xmlparse/xmlparse.c' % XMLLOC,
-                                '%s/expat/xmltok/xmlrole.c' % XMLLOC,
-                                '%s/expat/xmltok/xmltok.c' % XMLLOC,
-
-                                '%s/xh_bmp.cpp' % XMLLOC,
-                                '%s/xh_bmpbt.cpp' % XMLLOC,
-                                '%s/xh_bttn.cpp' % XMLLOC,
-                                '%s/xh_cald.cpp' % XMLLOC,
-                                '%s/xh_chckb.cpp' % XMLLOC,
-
-                                '%s/xh_chckl.cpp' % XMLLOC,
-                                '%s/xh_choic.cpp' % XMLLOC,
-                                '%s/xh_combo.cpp' % XMLLOC,
-                                '%s/xh_dlg.cpp' % XMLLOC,
-                                '%s/xh_frame.cpp' % XMLLOC,
-
-                                '%s/xh_gauge.cpp' % XMLLOC,
-                                '%s/xh_gdctl.cpp' % XMLLOC,
-                                '%s/xh_html.cpp' % XMLLOC,
-                                '%s/xh_listb.cpp' % XMLLOC,
-                                '%s/xh_listc.cpp' % XMLLOC,
-                                '%s/xh_menu.cpp' % XMLLOC,
-
-                                '%s/xh_notbk.cpp' % XMLLOC,
-                                '%s/xh_panel.cpp' % XMLLOC,
-                                '%s/xh_radbt.cpp' % XMLLOC,
-                                '%s/xh_radbx.cpp' % XMLLOC,
-                                '%s/xh_scrol.cpp' % XMLLOC,
-                                '%s/xh_scwin.cpp' % XMLLOC,
-
-                                '%s/xh_sizer.cpp' % XMLLOC,
-                                '%s/xh_slidr.cpp' % XMLLOC,
-                                '%s/xh_spin.cpp' % XMLLOC,
-                                '%s/xh_stbmp.cpp' % XMLLOC,
-                                '%s/xh_stbox.cpp' % XMLLOC,
-
-                                '%s/xh_stlin.cpp' % XMLLOC,
-                                '%s/xh_sttxt.cpp' % XMLLOC,
-                                '%s/xh_text.cpp' % XMLLOC,
-                                '%s/xh_toolb.cpp' % XMLLOC,
-                                '%s/xh_tree.cpp' % XMLLOC,
-
-                                '%s/xh_unkwn.cpp' % XMLLOC,
-                                '%s/xml.cpp' % XMLLOC,
-                                '%s/xmlres.cpp' % XMLLOC,
-                                '%s/xmlrsall.cpp' % XMLLOC,
+    ext = Extension('xrcc',
+                    ['%s/expat/xmlparse/xmlparse.c' % XMLLOC,
+                     '%s/expat/xmltok/xmlrole.c' % XMLLOC,
+                     '%s/expat/xmltok/xmltok.c' % XMLLOC,
 
-                             ] + swig_sources,
+                     ] + glob.glob('%s/xh_*.cpp' % XMLLOC) +
+
+                    [ '%s/xml.cpp' % XMLLOC,
+                      '%s/xmlres.cpp' % XMLLOC,
+                      '%s/xmlrsall.cpp' % XMLLOC,
+                      ] + swig_sources,
 
                     include_dirs =  xmlres_includes,
                     define_macros = defines,
@@ -991,11 +976,14 @@ if BUILD_GIZMOS:
         contrib_copy_tree(opj(CTRB_SRC, 'gizmos'), GIZMOLOC)
 
     ext = Extension('gizmosc', [
-                                '%s/dynamicsash.cpp' % GIZMOLOC,
-                                '%s/editlbox.cpp' % GIZMOLOC,
-                                #'%s/multicell.cpp' % GIZMOLOC,
-                                '%s/splittree.cpp' % GIZMOLOC,
-                                '%s/ledctrl.cpp'   % GIZMOLOC,
+                                '%s/dynamicsash.cpp'  % GIZMOLOC,
+                                '%s/editlbox.cpp'     % GIZMOLOC,
+                                '%s/splittree.cpp'    % GIZMOLOC,
+                                '%s/ledctrl.cpp'      % GIZMOLOC,
+                                #'%s/multicell.cpp'    % GIZMOLOC,
+
+                                '%s/treelistctrl.cpp' % location,
+
                              ] + swig_sources,
 
                     include_dirs =  gizmos_includes,
@@ -1171,15 +1159,16 @@ else:
                opj('scripts/xrced'),
                opj('scripts/pyshell'),
                opj('scripts/pycrust'),
-               opj('scripts/pycwrap'),
+               opj('scripts/pywrap'),
+               opj('scripts/pywrap'),
+               opj('scripts/pyalacarte'),
+               opj('scripts/pyalamode'),
                ]
 
 
-DATA_FILES.append( ('wxPython/tools/XRCed', glob.glob('wxPython/tools/XRCed/*.txt') +
-                                            [ 'wxPython/tools/XRCed/xrced.xrc']))
-
-DATA_FILES.append( ('wxPython/lib/PyCrust', glob.glob('wxPython/lib/PyCrust/*.txt') +
-                                            glob.glob('wxPython/lib/PyCrust/*.ico')))
+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', '*.txt', '*.css', '*.html')
 
 
 #----------------------------------------------------------------------
@@ -1197,15 +1186,25 @@ if __name__ == "__main__":
               url              = URL,
               license          = LICENSE,
 
-              packages = [PKGDIR,
-                          PKGDIR+'.lib',
-                          PKGDIR+'.lib.colourchooser',
-                          PKGDIR+'.lib.editor',
-                          PKGDIR+'.lib.mixins',
-                          PKGDIR+'.lib.PyCrust',
-                          PKGDIR+'.lib.PyCrust.wxd',
-                          PKGDIR+'.tools',
-                          PKGDIR+'.tools.XRCed',
+              packages = ['wxPython',
+                          'wxPython.lib',
+                          'wxPython.lib.colourchooser',
+                          'wxPython.lib.editor',
+                          'wxPython.lib.mixins',
+                          'wxPython.lib.PyCrust',
+                          'wxPython.py',
+                          'wxPython.py.wxd',
+                          'wxPython.tools',
+                          'wxPython.tools.XRCed',
+
+                          'wx',
+                          'wx.lib',
+                          'wx.lib.colourchooser',
+                          'wx.lib.editor',
+                          'wx.lib.mixins',
+                          'wx.py',
+                          'wx.tools',
+                          'wx.tools.XRCed',
                           ],
 
               ext_package = PKGDIR,