;ς »ΡCc@sidZdkZdkZdkZdkZdkZeadefd„ƒYZ e d„Z dZ dZ e d„Ze d„Zd „Zd „Zd Ze d „Zd „Zdefd„ƒYZedjo–dkZe d„Ze d„ZdddddddgZxLeD]DZeiideƒZei eƒei eiiedƒƒqWeii!dƒeieƒƒedƒGHedƒGHedƒGHdGHeieiƒHedƒed ƒed!ƒed"ƒed#ƒedƒed$ƒed%ƒed&d'gƒed$d(gƒed&d'gd)e"ƒed*ƒed"d+d$gƒyed,ƒWne j oZ#d-Ge#GHnXye dƒe d ƒWne j oZ#d.Ge#GHnXd/Z ed$ƒed&ƒed&e"ƒyed,ƒWne j oZ#d0Ge#GHnXxPeD]DZeiideƒZei$eiiedƒƒei$eƒqWndS(1sΫ If you have more than one version of wxPython installed this module allows your application to choose which version of wxPython will be imported when it does 'import wx'. The main function of this module is `select` and you use it like this:: import wxversion wxversion.select('2.4') import wx Or additional build options can also be selected, although they will not be required if they are not installed, like this:: import wxversion wxversion.select('2.5.3-unicode') import wx Or you can require an exact match on the build options like this:: import wxversion wxversion.select('2.5.3-unicode', optionsRequired=True) import wx Finally you can also specify a collection of versions that are allowed by your application, like this:: import wxversion wxversion.select(['2.5.4', '2.5.5', '2.6']) import wx Of course the default wxPython version can also be controlled by setting PYTHONPATH or by editing the wx.pth path configuration file, but using wxversion will allow an application to manage the version selection itself rather than depend on the user to setup the environment correctly. It works by searching the sys.path for directories matching wx-* and then comparing them to what was passed to the select function. If a match is found then that path is inserted into sys.path. NOTE: If you are making a 'bundle' of your application with a tool like py2exe then you should *not* use the wxversion module since it looks at the filesystem for the directories on sys.path, it will fail in a bundled environment. Instead you should simply ensure that the version of wxPython that you want is found by default on the sys.path when making the bundled version by setting PYTHONPATH. Then that version will be included in your bundle and your app will work as expected. Py2exe and the others usually have a way to tell at runtime if they are running from a bundle or running raw, so you can check that and only use wxversion if needed. For example, for py2exe:: if not hasattr(sys, 'frozen'): import wxversion wxversion.select('2.5') import wx More documentation on wxversion and multi-version installs can be found at: http://wiki.wxpython.org/index.cgi/MultiVersionInstalls Ns VersionErrorcBstZRS(N(s__name__s __module__(((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys VersionErrorQscCsHt|ƒtjo |g}nttj oHx5|D]-}tit|ƒ|ƒdjodSq4q4Wt dƒ‚nt i i dƒpt i i dƒot dƒ‚nt tƒ}t|||ƒ}|tjot dƒ‚nt iid|iƒtidd |iƒ}tii|ƒot iid|ƒn|adS( sύ Search for a wxPython installation that matches version. If one is found then sys.path is modified so that version will be imported with a 'import wx', otherwise a VersionError exception is raised. This funciton should only be caled once at the begining of the application before wxPython is imported. :param versions: Specifies the version to look for, it can either be a string or a list of strings. Each string is compared to the installed wxPythons and the best match is inserted into the sys.path, allowing an 'import wx' to find that version. The version string is composed of the dotted version number (at least 2 of the 4 components) optionally followed by hyphen ('-') separated options (wx port, unicode/ansi, flavour, etc.) A match is determined by how much of the installed version matches what is given in the version parameter. If the version number components don't match then the score is zero, otherwise the score is increased for every specified optional component that is specified and that matches. Please note, however, that it is possible for a match to be selected that doesn't exactly match the versions requested. The only component that is required to be matched is the version number. If you need to require a match on the other components as well, then please use the optional ``optionsRequired`` parameter described next. :param optionsRequired: Allows you to specify that the other components of the version string (such as the port name or character type) are also required to be present for an installed version to be considered a match. Using this parameter allows you to change the selection from a soft, as close as possible match to a hard, exact match. iNs@A previously selected wx version does not match the new request.swxswxPythons=wxversion.select() must be called before wxPython is importeds'Requested version of wxPython not founds/lib/s/lib64/(stypesversionssstrs _selectedsNonesversScores_wxPackageInfosoptionsRequireds VersionErrorssyssmodulesshas_keys_find_installedsTrues installeds_get_best_matchs bestMatchspathsinsertspathnamesressubspath64sossisdir(sversionssoptionsRequiredsvers installedspath64s bestMatch((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pysselectVs*&   &  shttp://wxPython.org/icCs$tiidƒptiidƒotdƒ‚nt}t|ƒ}t ƒ} | o=t| t ƒ}||jo|i ||ƒo |}q•n|tjoItƒ}x=|D]1}||jo|i ||ƒo |}Pq²q²Wn|tjoΚtotdƒ‚ndk} dk}digi} tƒD]} | d| ƒq8~ ƒ} | iƒ}| id|| fd d | iƒ}|| i jo|i!t"ƒn|i#ƒti$ƒnti%i&d |i'ƒt(i)d d |i'ƒ}t+i%i,|ƒoti%i&d |ƒn|a-dS(s 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. swxswxPythonsDwxversion.ensureMinimal() must be called before wxPython is importeds'Requested version of wxPython not foundNs s sέThis application requires a version of wxPython greater than or equal to %s, but a matching version was not found. You currently have these version(s) installed: %s Would you like to download a new version of wxPython? swxPython Upgrade Neededsstyleis/lib/s/lib64/(.ssyssmodulesshas_keys VersionErrorsNones bestMatchs_wxPackageInfos minVersionsminvs _find_defaults defaultPathsTruesdefvs CheckOptionssoptionsRequireds_find_installeds installedsinsts _EM_DEBUGswxs webbrowsersjoinsappends_[1]s getInstalledsversversionss PySimpleAppsapps MessageBoxsYES_NOsresultsYESsopens UPDATE_URLsMainLoopsexitspathsinsertspathnamesressubspath64sossisdirs _selected(s minVersionsoptionsRequiredsapps installedsresultsminvsdefvspath64s webbrowsersverswxs defaultPathsversionss_[1]s bestMatchsinst((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys ensureMinimal₯sH&        7  cCsIt|ƒtjo |g}ntƒ}t|||ƒ}|tj SdS(s” Check if there is a version of wxPython installed that matches one of the versions given. Returns True if so, False if not. This can be used to determine if calling `select` will succeed or not. :param versions: Same as in `select`, either a string or a list of strings specifying the version(s) to check for. :param optionsRequired: Same as in `select`. N( stypesversionssstrs_find_installeds installeds_get_best_matchsoptionsRequireds bestMatchsNone(sversionssoptionsRequireds installeds bestMatch((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pyscheckInstalledθs   cCsEtƒ}gi}|D]#}|tii|iƒdƒq~SdS(sr Returns a list of strings representing the installed wxPython versions that are found on the system. iN( s_find_installeds installedsappends_[1]spsosspathsbasenamespathname(s_[1]sps installed((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys getInstalledόs cCskt}d}xT|D]L}xC|D];}|it|ƒ|ƒ}||jo|}|}q q WqW|SdS(Ni( sNones bestMatchs bestScores installedspkgsversionssversScores_wxPackageInfosoptionsRequiredsscore(s installedsversionssoptionsRequiredsvers bestScoresscores bestMatchspkg((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys_get_best_match s s wx-[0-9].*cCsXg}g}xϋtiD]π}| o d}ntii|ƒ oqntii|ƒ}t i |t ƒo|i |ƒqnxt i tii|t ƒƒD]a}tii|ƒ oq‘ntiitii|dƒƒ oq‘n|i t|tƒƒq‘WqW|o+x(|D]}titii|ƒ=qWn|iƒ|iƒ|SdS(Ns.swx(s installedstoRemovessysspathspthsossisdirsbasenamesbasesfnmatchs fnmatchcases_patternsappendsglobsjoinsnamesexistss_wxPackageInfosTruesremoveExistingsremsindexssortsreverse(sremoveExistingsnamespths installedsbasesremstoRemove((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys_find_installeds4   #  cCsxktiD]`}| o d}ntii|ƒ oq ntii|ƒ}ti|t ƒo|Sq q Wx˜tiD]}| o d}ntii|ƒ oqxntii tii |dƒƒo8t tii |dƒƒi ƒ}tii ||ƒSqxqxWtSdS(Ns.swx.pth(ssysspathspthsossisdirsbasenamesbasesfnmatchs fnmatchcases_patternsexistssjoinsopensreadsNone(spthsbase((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys _find_default@s&     "!s_wxPackageInfocBsStZed„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( NcCs“||_tii|ƒ}|idƒ}|o|d}nt gi }|didƒD]}|t |ƒƒq]~ƒ|_|d|_dS(Ns-iis.(spathnamesselfsosspathsbasenamesbasessplitssegmentss stripFirststuplesappends_[1]sxsintsversionsoptions(sselfspathnames stripFirsts_[1]sbasesxssegments((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__init__\s CcCsd}tt|iƒt|iƒƒ}|i| |i| jodSn|d7}x>|iD]3}||ijo|d7}q^|odSq^q^W|SdS(Nii( sscoresminslensselfsversionsothersminlensoptionssoptsoptionsRequired(sselfsothersoptionsRequiredsoptsminlensscore((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pysScorefs!   cCsD| otSnx)|iD]}||ijotSqqWtSdS(N(soptionsRequiredsTruesselfsoptionssoptsothersFalse(sselfsothersoptionsRequiredsopt((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys CheckOptions{s  cCs:|i|ijp#|i|ijo|i|ijSdS(N(sselfsversionsothersoptions(sselfsother((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__lt__ˆscCs:|i|ijp#|i|ijo|i|ijSdS(N(sselfsversionsothersoptions(sselfsother((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__le__‹scCs:|i|ijp#|i|ijo|i|ijSdS(N(sselfsversionsothersoptions(sselfsother((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__gt__scCs:|i|ijp#|i|ijo|i|ijSdS(N(sselfsversionsothersoptions(sselfsother((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__ge__’scCs'|i|ijo|i|ijSdS(N(sselfsversionsothersoptions(sselfsother((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys__eq__–s( s__name__s __module__sFalses__init__sScores CheckOptionss__lt__s__le__s__gt__s__ge__s__eq__(((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys_wxPackageInfo[s     s__main__cCsDti}t||ƒd||tidfGH|t_tadS(NsAsked for %s, (%s): got: %si(ssysspathssavepathsselectsversionsoptionsRequiredsNones _selected(sversionsoptionsRequiredssavepath((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pystest₯s    cCsDti}t||ƒd||tidfGH|t_tadS(Ns EM: Asked for %s, (%s): got: %si(ssysspathssavepaths ensureMinimalsversionsoptionsRequiredsNones _selected(sversionsoptionsRequiredssavepath((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pystestEM³s    swx-2.4-gtk-ansiswx-2.5.2-gtk2-unicodeswx-2.5.3-gtk-ansiswx-2.6-gtk2-unicodeswx-2.6-gtk2-ansiswx-2.6-gtk-ansiswx-2.7.1-gtk2-ansis/tmpswxs2.4s 2.5-unicodes 2.99-bogussCurrent sys.path:s2.5s2.5-gtk2s2.5.2s2.5-ansis2.6s2.6-ansis 2.6-unicodes 2.7-unicodes2.7soptionsRequireds 2.4-unicodes2.5.3s2.9sAsked for 2.9: got Exception:s/Asked for incompatible versions, got Exception:is"EM: Asked for 2.9: got Exception:(%s__doc__sressyssossglobsfnmatchsNones _selecteds Exceptions VersionErrorsFalsesselects UPDATE_URLs _EM_DEBUGs ensureMinimalscheckInstalleds getInstalleds_get_best_matchs_patterns_find_installeds _find_defaultsobjects_wxPackageInfos__name__spprintsteststestEMsnamessnamespathsjoinsdsmkdirsappendsTruesesrmdir(s_get_best_matchs _find_defaults_patternsnamessselects _EM_DEBUGspprintsrestests_wxPackageInfosglobs getInstalledssysstestEMs UPDATE_URLsdscheckInstalledsnames_find_installeds VersionErrorsfnmatchsosses ensureMinimal((sn/mnt/gmirror/ports/x11-toolkits/py-wxPython26-common/work/wxPython-src-2.6.3.3/wxPython/wxversion/wxversion.pys?Ks†- J C   * B