diff --git a/wxPython/CHANGES.txt b/wxPython/CHANGES.txt index a084f8763e..de8d3c4081 100644 --- a/wxPython/CHANGES.txt +++ b/wxPython/CHANGES.txt @@ -14,6 +14,9 @@ be deprecated in the future) wxSWIG will use spam(*args, **kw) syntax instead. Also changed the generated __repr__ methods to be a bit more informative. +Made the version number information more robust and uh, informative. +Also added asserts to check that the major.minor versions of wxPython +and wxWindows match. diff --git a/wxPython/setup.py b/wxPython/setup.py index c96ab2fdb6..6a01f1d6e2 100755 --- a/wxPython/setup.py +++ b/wxPython/setup.py @@ -13,7 +13,12 @@ from distutils.command.install_data import install_data # flags and values that affect this script #---------------------------------------------------------------------- -VERSION = "2.4.0.8p1" +VER_MAJOR = 2 # The first three must match wxWindows +VER_MINOR = 4 +VER_RELEASE = 0 +VER_SUBREL = 8 # 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 " @@ -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"] @@ -483,22 +488,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) diff --git a/wxPython/src/__init__.py b/wxPython/src/__init__.py index 888f664d07..721ee6cb2b 100644 --- a/wxPython/src/__init__.py +++ b/wxPython/src/__init__.py @@ -12,13 +12,12 @@ #---------------------------------------------------------------------------- import __version__ -__version__ = __version__.ver +__version__ = __version__.wxVERSION_STRING # Ensure the main extension module is loaded, in case the add-on modules # (such as utils,) are used standalone. import wxc -wxc.__version__ = __version__ #---------------------------------------------------------------------------- diff --git a/wxPython/src/__version__.py b/wxPython/src/__version__.py index 762269c92f..ad96f71d25 100644 --- a/wxPython/src/__version__.py +++ b/wxPython/src/__version__.py @@ -1 +1,12 @@ -ver = '2.4.0.8p1' +# This file was generated by setup.py... + +wxVERSION_STRING = '2.4.0.8p1' +wxMAJOR_VERSION = 2 +wxMINOR_VERSION = 4 +wxRELEASE_VERSION = 0 +wxSUBREL_VERSION = 8 + +wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_VERSION, + wxSUBREL_VERSION, 'p1') + +wxRELEASE_NUMBER = wxRELEASE_VERSION # for compatibility diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index 40b307c43b..4c05555b55 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -654,15 +654,17 @@ if wxPlatform == "__WXMSW__": del os #---------------------------------------------------------------------- -# wxWindows version numbers. wxPython version is in __version__. +# Load version numbers from __version__... Ensure that major and minor +# versions are the same for both wxPython and wxWindows. -wxMAJOR_VERSION = wxc.wxMAJOR_VERSION -wxMINOR_VERSION = wxc.wxMINOR_VERSION -wxRELEASE_NUMBER = wxc.wxRELEASE_NUMBER -wxVERSION_STRING = wxc.wxVERSION_STRING -wxVERSION_NUMBER = wxc.wxVERSION_NUMBER +from wxPython.__version__ import * +__version__ = wxVERSION_STRING -wxVERSION = (wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER) +assert wxMAJOR_VERSION == wxc.wxMAJOR_VERSION, "wxPython/wxWindows version mismatch" +assert wxMINOR_VERSION == wxc.wxMINOR_VERSION, "wxPython/wxWindows version mismatch" +if wxRELEASE_VERSION != wxc.wxRELEASE_VERSION: + import warnings + warnings.warn("wxPython/wxWindows release number mismatch") #---------------------------------------------------------------------- diff --git a/wxPython/src/wx.i b/wxPython/src/wx.i index 747fa6839e..5b0091eecf 100644 --- a/wxPython/src/wx.i +++ b/wxPython/src/wx.i @@ -54,9 +54,6 @@ //--------------------------------------------------------------------------- - -#define __version__ "0.0.0" // The real value is now in setup.py... - %readonly wxPoint wxDefaultPosition; wxSize wxDefaultSize; @@ -287,17 +284,12 @@ static wxPyCoreAPI API = { initfontsc(); + // Although these are redfined in __version__ they need to be here too so + // that an assert can be done to ensure that the wxPython and the wxWindows + // versions match. PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION )); PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); - PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER )); - PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER )); -#if wxUSE_UNICODE - wxString tempStr(wxVERSION_STRING); - PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromWideChar(tempStr.c_str(), tempStr.Len())); -#else - PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING)); -#endif - + PyDict_SetItemString(d,"wxRELEASE_VERSION", PyInt_FromLong((long)wxRELEASE_NUMBER )); %}