On Sun, Jun 22, 2014 at 2:56 AM, Michał Górny <mgo...@gentoo.org> wrote:
> Dnia 2014-06-21, o godz. 20:01:50
> Mike Gilbert <flop...@gentoo.org> napisał(a):
>
>> Index: python-utils-r1.eclass
>> ===================================================================
>> RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
>> retrieving revision 1.58
>> diff -u -r1.58 python-utils-r1.eclass
>> --- python-utils-r1.eclass    19 Jun 2014 15:10:55 -0000      1.58
>> +++ python-utils-r1.eclass    21 Jun 2014 23:51:45 -0000
>> @@ -1110,5 +1110,33 @@
>>       fi
>>  }
>>
>> +# @FUNCTION: python_export_utf8_locale
>> +# @RETURN: 0 on success, 1 on failure.
>> +# @DESCRIPTION:
>> +# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does
>> +# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 
>> charmap.
>> +# This may be used to work around the quirky open() behavior of python3.
>> +python_export_utf8_locale() {
>> +     debug-print-function ${FUNCNAME} "${@}"
>> +
>> +     if [[ -z ${LC_ALL} && $(locale charmap) != UTF-8 ]]; then
>
> What about people with LC_ALL set? Should we complain?
>

Yeah, I guess that makes sense. I just wanted to avoid overriding it
and causing people to get messages in another language, etc.

>> +             # Try English first, then everything else.
>> +             local lang locales="en_US.UTF-8 $(locale -a)"
>
> I think we should start with C.UTF-8 :).
>

I agree. However, our glibc doesn't actually support that. ^_^

>> +
>> +             for lang in ${locales}; do
>> +                     if [[ $(LC_CTYPE=${lang} locale charmap) == UTF-8 ]]; 
>> then
>
> This is a bit verbose when you try a locale that isn't supported.
> I suggest 2>/dev/null.
>

Will do.

>> +                             export LC_CTYPE=${lang}
>> +                             return 0
>> +                     fi
>> +             done
>> +
>> +             ewarn "Could not find a UTF-8 locale."
>
> I think you ought to be a little more verbose here. The user doesn't
> see anything else so he'll have no idea what's happening.
>

Will do.

Reply via email to