+ if type(versions) == str:
+ versions = [versions]
+
+ global _selected
+ if _selected is not None:
+ # A version was previously selected, ensure that it matches
+ # this new request
+ for ver in versions:
+ if _selected.Score(_wxPackageInfo(ver)) > 0:
+ return
+ # otherwise, raise an exception
+ raise VersionError("A previously selected wx version does not match the new request.")
+
+ # If we get here then this is the first time wxversion is used,
+ # ensure that wxPython hasn't been imported yet.
+ if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
+ raise VersionError("wxversion.select() must be called before wxPython is imported")
+
+ # Look for a matching version and manipulate the sys.path as
+ # needed to allow it to be imported.
+ installed = _find_installed(True)
+ bestMatch = _get_best_match(installed, versions)
+
+ if bestMatch is None:
+ raise VersionError("Requested version of wxPython not found")
+
+ sys.path.insert(0, bestMatch.pathname)
+ _selected = bestMatch
+
+#----------------------------------------------------------------------
+
+UPDATE_URL = "http://wxPython.org/"
+#UPDATE_URL = "http://sourceforge.net/project/showfiles.php?group_id=10718"
+
+
+def ensureMinimal(minVersion):
+ """
+ Checks to see if the default version of wxPython is greater-than
+ or equal to `minVersion`. If not then it will try to find an
+ installed version that is >= minVersion. If none are available
+ then a message is displayed that will inform the user and will
+ offer to open their web browser to the wxPython downloads page,
+ and will then exit the application.
+ """
+ assert type(minVersion) == str
+
+ # ensure that wxPython hasn't been imported yet.
+ if sys.modules.has_key('wx') or sys.modules.has_key('wxPython'):
+ raise VersionError("wxversion.ensureMinimal() must be called before wxPython is imported")