floppym     14/06/29 14:24:22

  Modified:             ChangeLog distutils-r1.eclass
                        python-utils-r1.eclass
  Log:
  Attempt to use a UTF-8 locale if one is available to avoid errors when 
setup.py calls open() with no encoding.

Revision  Changes    Path
1.1306               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1306&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1306&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1305&r2=1.1306

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1305
retrieving revision 1.1306
diff -u -r1.1305 -r1.1306
--- ChangeLog   29 Jun 2014 08:32:46 -0000      1.1305
+++ ChangeLog   29 Jun 2014 14:24:22 -0000      1.1306
@@ -1,6 +1,11 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1305 2014/06/29 
08:32:46 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1306 2014/06/29 
14:24:22 floppym Exp $
+
+  29 Jun 2014; Mike Gilbert <[email protected]> distutils-r1.eclass,
+  python-utils-r1.eclass:
+  Attempt to use a UTF-8 locale if one is available to avoid errors when
+  setup.py calls open() with no encoding.
 
   29 Jun 2014; Michał Górny <[email protected]> multilib-build.eclass:
   Fix handling empty MULTILIB_COMPAT.



1.100                eclass/distutils-r1.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.100&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.100&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.99&r2=1.100

Index: distutils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- distutils-r1.eclass 22 Jun 2014 07:01:37 -0000      1.99
+++ distutils-r1.eclass 29 Jun 2014 14:24:22 -0000      1.100
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.99 
2014/06/22 07:01:37 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.100 
2014/06/29 14:24:22 floppym Exp $
 
 # @ECLASS: distutils-r1
 # @MAINTAINER:
@@ -690,6 +690,8 @@
 }
 
 distutils-r1_src_configure() {
+       python_export_utf8_locale
+
        if declare -f python_configure >/dev/null; then
                _distutils-r1_run_foreach_impl python_configure
        fi



1.59                 eclass/python-utils-r1.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.59&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.59&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?r1=1.58&r2=1.59

Index: python-utils-r1.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- python-utils-r1.eclass      19 Jun 2014 15:10:55 -0000      1.58
+++ python-utils-r1.eclass      29 Jun 2014 14:24:22 -0000      1.59
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.58 
2014/06/19 15:10:55 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.59 
2014/06/29 14:24:22 floppym Exp $
 
 # @ECLASS: python-utils-r1
 # @MAINTAINER:
@@ -1110,5 +1110,40 @@
        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 [[ $(locale charmap) != UTF-8 ]]; then
+               if [[ -n ${LC_ALL} ]]; then
+                       ewarn "LC_ALL is set to a locale with a charmap other 
than UTF-8."
+                       ewarn "This may trigger build failures in some python 
packages."
+                       return 1
+               fi
+
+               # Try English first, then everything else.
+               local lang locales="en_US.UTF-8 $(locale -a)"
+
+               for lang in ${locales}; do
+                       if [[ $(LC_CTYPE=${lang} locale charmap 2>/dev/null) == 
UTF-8 ]]; then
+                               export LC_CTYPE=${lang}
+                               return 0
+                       fi  
+               done
+
+               ewarn "Could not find a UTF-8 locale. This may trigger build 
failures in"
+               ewarn "some python packages. Please ensure that a UTF-8 locale 
is listed in"
+               ewarn "/etc/locale.gen and run locale-gen."
+               return 1
+       fi  
+
+       return 0
+}
+
 _PYTHON_UTILS_R1=1
 fi




Reply via email to