Commit 1b856da5 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Look at whether we already have a UTF8 locale, before trying to find one

This works around a problem on (old?) Fedora systems, where "locale -a"
lists every locale that /might/ exist, rather than only those that /do/
exist.
parent 92f9e980
......@@ -23,20 +23,25 @@ from testglobals import *
os.environ['TERM'] = 'vt100'
# Try and find a utf8 locale to use
# First see if 'locale -a' works
h = os.popen('locale -a', 'r')
# First see if we already have a UTF8 locale
h = os.popen('locale | grep LC_CTYPE | grep -i utf', 'r')
v = h.read()
h.close()
if v != '':
# If it does then use the first utf8 locale that is available
h = os.popen('locale -a | grep -i utf8 | head', 'r')
if v == '':
# We don't, so now see if 'locale -a' works
h = os.popen('locale -a', 'r')
v = h.read()
h.close()
if v != '':
os.environ['LC_ALL'] = v
else:
print 'WARNING: No UTF8 locale found.'
print 'You may get some spurious test failures.'
# If it does then use the first utf8 locale that is available
h = os.popen('locale -a | grep -i utf8 | head', 'r')
v = h.read()
h.close()
if v != '':
os.environ['LC_ALL'] = v
else:
print 'WARNING: No UTF8 locale found.'
print 'You may get some spurious test failures.'
global config
config = getConfig() # get it from testglobals
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment