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.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19926 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-04-02 01:49:07 +00:00
parent d842ec8482
commit 58ccbbc7b7
6 changed files with 58 additions and 30 deletions

View File

@@ -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 instead. Also changed the generated __repr__ methods to be a bit more
informative. 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.

View File

@@ -13,7 +13,12 @@ from distutils.command.install_data import install_data
# flags and values that affect this script # 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" DESCRIPTION = "Cross platform GUI toolkit for Python"
AUTHOR = "Robin Dunn" AUTHOR = "Robin Dunn"
AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>" AUTHOR_EMAIL = "Robin Dunn <robin@alldunn.com>"
@@ -201,7 +206,7 @@ def Verify_WX_CONFIG():
uf = 'u' uf = 'u'
else: else:
uf = '' uf = ''
ver2 = VERSION[:3] ver2 = "%s.%s" % (VER_MAJOR, VER_MINOR)
WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2) WX_CONFIG = 'wx%s%s%s-%s-config' % (WXPORT, uf, df, ver2)
searchpath = os.environ["PATH"] 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: if UNICODE:
BUILD_BASE = BUILD_BASE + '.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)

View File

@@ -12,13 +12,12 @@
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
import __version__ import __version__
__version__ = __version__.ver __version__ = __version__.wxVERSION_STRING
# Ensure the main extension module is loaded, in case the add-on modules # Ensure the main extension module is loaded, in case the add-on modules
# (such as utils,) are used standalone. # (such as utils,) are used standalone.
import wxc import wxc
wxc.__version__ = __version__
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------

View File

@@ -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

View File

@@ -654,15 +654,17 @@ if wxPlatform == "__WXMSW__":
del os 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 from wxPython.__version__ import *
wxMINOR_VERSION = wxc.wxMINOR_VERSION __version__ = wxVERSION_STRING
wxRELEASE_NUMBER = wxc.wxRELEASE_NUMBER
wxVERSION_STRING = wxc.wxVERSION_STRING
wxVERSION_NUMBER = wxc.wxVERSION_NUMBER
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")
#---------------------------------------------------------------------- #----------------------------------------------------------------------

View File

@@ -54,9 +54,6 @@
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
#define __version__ "0.0.0" // The real value is now in setup.py...
%readonly %readonly
wxPoint wxDefaultPosition; wxPoint wxDefaultPosition;
wxSize wxDefaultSize; wxSize wxDefaultSize;
@@ -287,17 +284,12 @@ static wxPyCoreAPI API = {
initfontsc(); 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,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION )); PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER )); PyDict_SetItemString(d,"wxRELEASE_VERSION", 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
%} %}