[libcxx] r302396 - Fix Windows locale detection

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Sun May 7 19:09:48 PDT 2017


Author: ericwf
Date: Sun May  7 21:09:48 2017
New Revision: 302396

URL: http://llvm.org/viewvc/llvm-project?rev=302396&view=rev
Log:
Fix Windows locale detection

Modified:
    libcxx/trunk/utils/libcxx/test/target_info.py

Modified: libcxx/trunk/utils/libcxx/test/target_info.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/target_info.py?rev=302396&r1=302395&r2=302396&view=diff
==============================================================================
--- libcxx/trunk/utils/libcxx/test/target_info.py (original)
+++ libcxx/trunk/utils/libcxx/test/target_info.py Sun May  7 21:09:48 2017
@@ -46,25 +46,26 @@ def test_locale(loc):
         locale.setlocale(locale.LC_ALL, default_locale)
 
 
-def add_common_locales(features, lit_config):
+def add_common_locales(features, lit_config, is_windows=False):
     # A list of locales needed by the test-suite.
     # The list uses the canonical name for the locale used in the test-suite
     # TODO: On Linux ISO8859 *may* needs to hyphenated.
     locales = [
-        'en_US.UTF-8',
-        'fr_FR.UTF-8',
-        'ru_RU.UTF-8',
-        'zh_CN.UTF-8',
-        'fr_CA.ISO8859-1',
-        'cs_CZ.ISO8859-2'
+        ('en_US.UTF-8', 'English_United States.1252'),
+        ('fr_FR.UTF-8', 'French_France.1252'),
+        ('ru_RU.UTF-8', 'Russian_Russia.1251'),
+        ('zh_CN.UTF-8', 'Chinese_China.936'),
+        ('fr_CA.ISO8859-1', 'French_Canada.1252'),
+        ('cs_CZ.ISO8859-2', 'Czech_Czech Republic.1250')
     ]
-    for loc in locales:
-        if test_locale(loc):
-            features.add('locale.{0}'.format(loc))
+    for loc_id, windows_loc_name in locales:
+        loc_name = windows_loc_name if is_windows else loc_id
+        if test_locale(loc_name):
+            features.add('locale.{0}'.format(loc_id))
         else:
             lit_config.warning('The locale {0} is not supported by '
                                'your platform. Some tests will be '
-                               'unsupported.'.format(loc))
+                               'unsupported.'.format(loc_name))
 
 
 class DarwinLocalTI(DefaultTargetInfo):
@@ -251,7 +252,8 @@ class WindowsLocalTI(DefaultTargetInfo):
         super(WindowsLocalTI, self).__init__(full_config)
 
     def add_locale_features(self, features):
-        add_common_locales(features, self.full_config.lit_config)
+        add_common_locales(features, self.full_config.lit_config,
+                           is_windows=True)
 
     def use_lit_shell_default(self):
         # Default to the internal shell on Windows, as bash on Windows is




More information about the cfe-commits mailing list