Revision: 7256
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7256&view=rev
Author: efiring
Date: 2009-07-11 18:06:54 +0000 (Sat, 11 Jul 2009)
Log Message:
-----------
Yet another iteration on the version checking in backend_wx
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-07-11
16:52:44 UTC (rev 7255)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-07-11
18:06:54 UTC (rev 7256)
@@ -116,28 +116,31 @@
raise ImportError(missingwx)
# Some early versions of wxversion lack AlreadyImportedError.
-if hasattr(wxversion, 'AlreadyImportedError'):
- try:
- wxversion.ensureMinimal('2.8')
- except wxversion.AlreadyImportedError:
- pass
-else:
- warnings.warn(
- "Update your wxversion.py to one including AlreadyImportedError")
- try:
- wxversion.ensureMinimal('2.8')
- except wxversion.VersionError:
- pass
+# It was added around 2.8.4?
+try:
+ _wx_ensure_failed = wxversion.AlreadyImportedError
+except AttributeError:
+ _wx_ensure_failed = wxversion.VersionError
try:
+ wxversion.ensureMinimal('2.8')
+except _wx_ensure_failed:
+ pass
+# We don't really want to pass in case of VersionError, but when
+# AlreadyImportedError is not available, we have to.
+
+try:
import wx
backend_version = wx.VERSION_STRING
except ImportError:
raise ImportError(missingwx)
-# Extra version check in case wxversion is broken:
+# Extra version check in case wxversion lacks AlreadyImportedError;
+# then VersionError might have been raised and ignored when
+# there really *is* a problem with the version.
major, minor = [int(n) for n in backend_version.split('.')[:2]]
if major < 2 or (major < 3 and minor < 8):
+ print " wxPython version %s was imported." % backend_version
raise ImportError(missingwx)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins