Fix Windows locale detection

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@302396 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2017-05-08 02:09:48 +00:00
parent 720637d9f2
commit ca052ce73a

View File

@@ -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