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?

> +             # Try English first, then everything else.
> +             local lang locales="en_US.UTF-8 $(locale -a)"

I think we should start with C.UTF-8 :).

> +
> +             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.

> +                             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.

> +             return 1
> +     fi  
> +
> +     return 0
> +}
> +
> +
>  _PYTHON_UTILS_R1=1
>  fi
> 



-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to