def _setLocale(self, primaryLocale, ignoreError=False): if wxIsAvailable(): # Strip the country code for wxLocales # since any invalid values raise an # uncapturable error in the wx Widgets layer. # With the exception of Chinese, all # wx localizations use the lang # code exclusively. # XXX [grant] Also, pt_BR is common. This just seems # bogus. try: setWxLocale(stripCountryCode(primaryLocale), self) except I18nException: if not ignoreError: raise setPyICULocale(primaryLocale) setEnvironmentLocale(primaryLocale) from application import Utility if Utility.getPlatformID() == "osx-ppc" and \ Utility.getOSName() in ('10.3-Panther', '10.4-Tiger'): # On OS X PPC the LC_NUMERIC values will # localize unless the Python locale is # set to 'C'. Localized numeric values ie. # 1234,23 for a float in the 'FR' locale # create data exchange issues and needs to # be avoided at all costs. setPythonLocale('C') else: setPythonLocale(primaryLocale)
def matchDownloadUrl(urls, platformID=Utility.getPlatformID(), osName=Utility.getOSName()): matchedPlatform = '' matchedURL = None if platformID in ('win', 'win-cygwin'): platformID = 'windows' components = ("%s-%s" % (platformID, osName)).split('-') for platform, url in urls.iteritems(): theseComponents = platform.split('-') if (components[:len(theseComponents)] == theseComponents and len(platform) > len(matchedPlatform)): matchedPlatform = platform matchedURL = url return matchedURL