X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1a014e508049dd65c8d5866f3651f1daeb8b9176..26f26e06c4eb7d21c3c74a35ffd5d1a28bc8bd3c:/wxPython/config.py diff --git a/wxPython/config.py b/wxPython/config.py index 069da05942..fa74e2acc3 100644 --- a/wxPython/config.py +++ b/wxPython/config.py @@ -38,9 +38,9 @@ import distutils.command.clean VER_MAJOR = 2 # The first three must match wxWidgets VER_MINOR = 5 -VER_RELEASE = 3 -VER_SUBREL = 0 # wxPython release num for x.y.z release of wxWidgets -VER_FLAGS = "p" # release flags, such as prerelease num, unicode, etc. +VER_RELEASE = 4 +VER_SUBREL = 1 # wxPython release num for x.y.z release of wxWidgets +VER_FLAGS = "" # release flags, such as prerelease num, unicode, etc. DESCRIPTION = "Cross platform GUI toolkit for Python" AUTHOR = "Robin Dunn" @@ -79,14 +79,14 @@ Topic :: Software Development :: User Interfaces # Config values below this point can be reset on the setup.py command line. BUILD_GLCANVAS = 1 # If true, build the contrib/glcanvas extension module -BUILD_OGL = 1 # If true, build the contrib/ogl extension module +BUILD_OGL = 0 # If true, build the contrib/ogl extension module BUILD_STC = 1 # If true, build the contrib/stc extension module BUILD_GIZMOS = 1 # Build a module for the gizmos contrib library 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) -BUILD_IEWIN = (os.name == 'nt') +BUILD_IEWIN = 0 #(os.name == 'nt') BUILD_ACTIVEX = (os.name == 'nt') # new version of IEWIN and more @@ -134,9 +134,12 @@ INSTALL_MULTIVERSION = 1 # Install the packages such that multiple versions FLAVOUR = "" # Optional flavour string to be appended to VERSION # in MULTIVERSION installs - -INSTALL_WXRC = 0 # Should the Python version of wxrc be installed? +EP_ADD_OPTS = 1 # When doing MULTIVERSION installs the wx port and + # ansi/unicode settings can optionally be added to the + # subdir path used in site-packages + + WX_CONFIG = None # Usually you shouldn't need to touch this, but you can set # it to pass an alternate version of wx-config or alternate # flags, eg. as required by the .deb in-tree build. By @@ -160,16 +163,22 @@ CONTRIBS_INC = "" # A dir to add as an -I flag when compiling the contribs # Some MSW build settings -FINAL = 0 # Mirrors use of same flag in wx makefiles, - # (0 or 1 only) should probably find a way to - # autodetect this... +MONOLITHIC = 1 # The core wxWidgets lib can be built as either a + # single monolithic DLL or as a collection of DLLs. + # This flag controls which set of libs will be used + # on Windows. (For other platforms it is automatic + # via using wx-config.) + +FINAL = 0 # Will use the release version of the wxWidgets libs on MSW. + +HYBRID = 1 # Will use the "hybrid" version of the wxWidgets + # libs on MSW. A "hybrid" build is one that is + # basically a release build, but that also defines + # __WXDEBUG__ to activate the runtime checks and + # assertions in the library. When any of these is + # triggered it is turned into a Python exception so + # this is a very useful feature to have turned on. -HYBRID = 1 # If set and not debug or FINAL, then build a - # hybrid extension that can be used by the - # non-debug version of python, but contains - # debugging symbols for wxWidgets and wxPython. - # wxWidgets must have been built with /MD, not /MDd - # (using FINAL=hybrid will do it.) # Version part of wxWidgets LIB/DLL names WXDLLVER = '%d%d' % (VER_MAJOR, VER_MINOR) @@ -234,8 +243,8 @@ for flag in ['BUILD_GLCANVAS', 'BUILD_OGL', 'BUILD_STC', 'BUILD_GIZMOS', 'BUILD_DLLWIDGET', 'BUILD_IEWIN', 'BUILD_ACTIVEX', 'CORE_ONLY', 'PREP_ONLY', 'USE_SWIG', 'UNICODE', 'UNDEF_NDEBUG', 'NO_SCRIPTS', 'NO_HEADERS', 'BUILD_RENAMERS', - 'FULL_DOCS', 'INSTALL_MULTIVERSION', 'INSTALL_WXRC', - 'FINAL', 'HYBRID', ]: + 'FULL_DOCS', 'INSTALL_MULTIVERSION', 'EP_ADD_OPTS', + 'MONOLITHIC', 'FINAL', 'HYBRID', ]: for x in range(len(sys.argv)): if sys.argv[x].find(flag) == 0: pos = sys.argv[x].find('=') + 1 @@ -257,6 +266,37 @@ for option in ['WX_CONFIG', 'WXDLLVER', 'BUILD_BASE', 'WXPORT', 'SWIG', sys.argv = filter(None, sys.argv) +#---------------------------------------------------------------------- +# build options file +#---------------------------------------------------------------------- + +build_options_template = """ +UNICODE=%d +UNDEF_NDEBUG=%d +INSTALL_MULTIVERSION=%d +FLAVOUR="%s" +EP_ADD_OPTS=%d +WX_CONFIG="%s" +WXPORT="%s" +MONOLITHIC=%d +FINAL=%d +HYBRID=%d +""" % (UNICODE, UNDEF_NDEBUG, INSTALL_MULTIVERSION, FLAVOUR, EP_ADD_OPTS, + WX_CONFIG, WXPORT, MONOLITHIC, FINAL, HYBRID) + +try: + from build_options import * +except: + build_options_file = os.path.join(os.path.dirname(__file__), "build_options.py") + if not os.path.exists(build_options_file): + try: + myfile = open(build_options_file, "w") + myfile.write(build_options_template) + myfile.close() + except: + print "WARNING: Unable to create build_options.py." + + #---------------------------------------------------------------------- # some helper functions #---------------------------------------------------------------------- @@ -285,6 +325,8 @@ def Verify_WX_CONFIG(): msg("Found wx-config: " + fp) msg(" Using flags: " + flags) WX_CONFIG = fp + flags + if hasattr(sys, 'setup_is_main') and not sys.setup_is_main: + WX_CONFIG += " 2>/dev/null " break else: msg("ERROR: WX_CONFIG not specified and wx-config not found on the $PATH") @@ -326,9 +368,14 @@ def run_swig(files, dir, gendir, package, USE_SWIG, force, swig_args, if not cleaning and USE_SWIG: for dep in swig_deps: - if newer(dep, py_file) or newer(dep, cpp_file): - force = 1 - break + # this may fail for external builds, but it's not + # a fatal error, so keep going. + try: + if newer(dep, py_file) or newer(dep, cpp_file): + force = 1 + break + except: + pass if force or newer(i_file, py_file) or newer(i_file, cpp_file): ## we need forward slashes here even on win32 @@ -505,9 +552,10 @@ def find_data_files(srcdir, *wildcards): def makeLibName(name): if os.name == 'posix': libname = '%s_%s-%s' % (WXBASENAME, name, WXRELEASE) - else: + elif name: libname = 'wxmsw%s%s_%s' % (WXDLLVER, libFlag(), name) - + else: + libname = 'wxmsw%s%s' % (WXDLLVER, libFlag()) return [libname] @@ -554,14 +602,18 @@ def getExtraPath(shortVer=True, addOpts=False): if shortVer: # short version, just Major.Minor ep = "wx-%d.%d" % (VER_MAJOR, VER_MINOR) + # plus release if minor is odd if VER_MINOR % 2 == 1: ep += ".%d" % VER_RELEASE + else: # long version, full version ep = "wx-%d.%d.%d.%d" % (VER_MAJOR, VER_MINOR, VER_RELEASE, VER_SUBREL) if addOpts: + port = WXPORT + if port == "msw": port = "win32" ep += "-%s-%s" % (WXPORT, (UNICODE and 'unicode' or 'ansi')) if FLAVOUR: @@ -569,8 +621,6 @@ def getExtraPath(shortVer=True, addOpts=False): return ep - - #---------------------------------------------------------------------- # sanity checks @@ -590,7 +640,7 @@ if debug: if FINAL: HYBRID = 0 -if UNICODE and WXPORT not in ['msw', 'gtk2']: +if UNICODE and WXPORT not in ['msw', 'gtk2', 'mac']: raise SystemExit, "UNICODE mode not currently supported on this WXPORT: "+WXPORT @@ -615,7 +665,7 @@ if os.name == 'nt': WXDIR = '..' # assumes in CVS tree WXPLAT = '__WXMSW__' GENDIR = 'msw' - + includes = ['include', 'src', opj(WXDIR, 'lib', 'vc_dll', 'msw' + libFlag()), opj(WXDIR, 'include'), @@ -628,7 +678,7 @@ if os.name == 'nt': (WXPLAT, None), ('WXUSINGDLL', '1'), - ('SWIG_GLOBAL', None), + ('SWIG_TYPE_TABLE', '_wxPython_table'), ('WXP_USE_THREAD', '1'), ] @@ -642,14 +692,17 @@ if os.name == 'nt': defines.append( ('__WXDEBUG__', None) ) libdirs = [ opj(WXDIR, 'lib', 'vc_dll') ] - libs = [ 'wxbase' + WXDLLVER + libFlag(), # TODO: trim this down to what is really needed for the core - 'wxbase' + WXDLLVER + libFlag() + '_net', - 'wxbase' + WXDLLVER + libFlag() + '_xml', - makeLibName('core')[0], - makeLibName('adv')[0], - makeLibName('html')[0], - makeLibName('xrc')[0], - ] + if MONOLITHIC: + libs = makeLibName('') + else: + libs = [ 'wxbase' + WXDLLVER + libFlag(), + 'wxbase' + WXDLLVER + libFlag() + '_net', + 'wxbase' + WXDLLVER + libFlag() + '_xml', + makeLibName('core')[0], + makeLibName('adv')[0], + makeLibName('html')[0], + makeLibName('xrc')[0], + ] libs = libs + ['kernel32', 'user32', 'gdi32', 'comdlg32', 'winspool', 'winmm', 'shell32', 'oldnames', 'comctl32', @@ -679,7 +732,7 @@ if os.name == 'nt': elif os.name == 'posix': WXDIR = '..' includes = ['include', 'src'] - defines = [('SWIG_GLOBAL', None), + defines = [('SWIG_TYPE_TABLE', 'wxPython_type_table'), ('HAVE_CONFIG_H', None), ('WXP_USE_THREAD', '1'), ] @@ -714,7 +767,7 @@ elif os.name == 'posix': WXPREFIX = os.popen(WX_CONFIG + ' --prefix').read()[:-1] - if sys.platform[:6] == "darwin": + if sys.platform[:6] == "darwin" and WXPORT == 'mac': # Flags and such for a Darwin (Max OS X) build of Python WXPLAT = '__WXMAC__' GENDIR = 'mac' @@ -767,7 +820,7 @@ else: if UNICODE: BUILD_BASE = BUILD_BASE + '.unicode' - VER_FLAGS += 'u' + ##VER_FLAGS += 'u' if os.path.exists('DAILY_BUILD'): @@ -781,6 +834,20 @@ VERSION = "%s.%s.%s.%s%s" % (VER_MAJOR, VER_MINOR, VER_RELEASE, # SWIG defaults #---------------------------------------------------------------------- +# *.i files could live in the wxWidgets/wxPython/src dir, or in +# a subdirectory of the devel package. Let's specify both +# dirs as includes so we don't have to guess which is correct. + +wxfilesdir = "" +i_subdir = opj("include", "wx", "wxPython", "i_files") +if os.name != "nt": + wxfilesdir = opj(WXPREFIX, i_subdir) +else: + wxfilesdir = opj(WXPY_SRC, i_subdir) + +i_files_includes = [ '-I' + opj(WXPY_SRC, 'src'), + '-I' + wxfilesdir ] + swig_cmd = SWIG swig_force = force swig_args = ['-c++', @@ -791,11 +858,9 @@ swig_args = ['-c++', '-keyword', '-new_repr', '-modern', - - '-I' + opj(WXPY_SRC, 'src'), '-D'+WXPLAT, - '-noruntime' - ] + ] + i_files_includes + if UNICODE: swig_args.append('-DwxUSE_UNICODE') @@ -804,10 +869,7 @@ if FULL_DOCS: swig_deps = [ opj(WXPY_SRC, 'src/my_typemaps.i'), - opj(WXPY_SRC, 'src/my_fragments.i'), - opj(WXPY_SRC, 'src/common.swg'), - opj(WXPY_SRC, 'src/pyrun.swg'), - opj(WXPY_SRC, 'src/python.swg'), + opj(WXPY_SRC, 'src/pyfragments.swg'), ] depends = [ #'include/wx/wxPython/wxPython.h', @@ -822,8 +884,6 @@ depends = [ #'include/wx/wxPython/wxPython.h', #################################### import pprint -import xml.sax - try: import libxml2 FOUND_LIBXML2 = True @@ -832,7 +892,6 @@ except ImportError: #--------------------------------------------------------------------------- - renamerTemplateStart = """\ // A bunch of %rename directives generated by BuildRenamers in config.py // in order to remove the wx prefix from all global scope names.