Gentoo Archives: gentoo-commits

From: "Mike Gilbert (floppym)" <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog distutils-r1.eclass python-utils-r1.eclass
Date: Sun, 29 Jun 2014 14:24:26
Message-Id: 20140629142422.972B42004E@flycatcher.gentoo.org
1 floppym 14/06/29 14:24:22
2
3 Modified: ChangeLog distutils-r1.eclass
4 python-utils-r1.eclass
5 Log:
6 Attempt to use a UTF-8 locale if one is available to avoid errors when setup.py calls open() with no encoding.
7
8 Revision Changes Path
9 1.1306 eclass/ChangeLog
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1306&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1306&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1305&r2=1.1306
14
15 Index: ChangeLog
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
18 retrieving revision 1.1305
19 retrieving revision 1.1306
20 diff -u -r1.1305 -r1.1306
21 --- ChangeLog 29 Jun 2014 08:32:46 -0000 1.1305
22 +++ ChangeLog 29 Jun 2014 14:24:22 -0000 1.1306
23 @@ -1,6 +1,11 @@
24 # ChangeLog for eclass directory
25 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1305 2014/06/29 08:32:46 mgorny Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1306 2014/06/29 14:24:22 floppym Exp $
28 +
29 + 29 Jun 2014; Mike Gilbert <floppym@g.o> distutils-r1.eclass,
30 + python-utils-r1.eclass:
31 + Attempt to use a UTF-8 locale if one is available to avoid errors when
32 + setup.py calls open() with no encoding.
33
34 29 Jun 2014; Michał Górny <mgorny@g.o> multilib-build.eclass:
35 Fix handling empty MULTILIB_COMPAT.
36
37
38
39 1.100 eclass/distutils-r1.eclass
40
41 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.100&view=markup
42 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?rev=1.100&content-type=text/plain
43 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/distutils-r1.eclass?r1=1.99&r2=1.100
44
45 Index: distutils-r1.eclass
46 ===================================================================
47 RCS file: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v
48 retrieving revision 1.99
49 retrieving revision 1.100
50 diff -u -r1.99 -r1.100
51 --- distutils-r1.eclass 22 Jun 2014 07:01:37 -0000 1.99
52 +++ distutils-r1.eclass 29 Jun 2014 14:24:22 -0000 1.100
53 @@ -1,6 +1,6 @@
54 # Copyright 1999-2014 Gentoo Foundation
55 # Distributed under the terms of the GNU General Public License v2
56 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.99 2014/06/22 07:01:37 mgorny Exp $
57 +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.100 2014/06/29 14:24:22 floppym Exp $
58
59 # @ECLASS: distutils-r1
60 # @MAINTAINER:
61 @@ -690,6 +690,8 @@
62 }
63
64 distutils-r1_src_configure() {
65 + python_export_utf8_locale
66 +
67 if declare -f python_configure >/dev/null; then
68 _distutils-r1_run_foreach_impl python_configure
69 fi
70
71
72
73 1.59 eclass/python-utils-r1.eclass
74
75 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.59&view=markup
76 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?rev=1.59&content-type=text/plain
77 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-utils-r1.eclass?r1=1.58&r2=1.59
78
79 Index: python-utils-r1.eclass
80 ===================================================================
81 RCS file: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v
82 retrieving revision 1.58
83 retrieving revision 1.59
84 diff -u -r1.58 -r1.59
85 --- python-utils-r1.eclass 19 Jun 2014 15:10:55 -0000 1.58
86 +++ python-utils-r1.eclass 29 Jun 2014 14:24:22 -0000 1.59
87 @@ -1,6 +1,6 @@
88 # Copyright 1999-2014 Gentoo Foundation
89 # Distributed under the terms of the GNU General Public License v2
90 -# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.58 2014/06/19 15:10:55 mgorny Exp $
91 +# $Header: /var/cvsroot/gentoo-x86/eclass/python-utils-r1.eclass,v 1.59 2014/06/29 14:24:22 floppym Exp $
92
93 # @ECLASS: python-utils-r1
94 # @MAINTAINER:
95 @@ -1110,5 +1110,40 @@
96 fi
97 }
98
99 +# @FUNCTION: python_export_utf8_locale
100 +# @RETURN: 0 on success, 1 on failure.
101 +# @DESCRIPTION:
102 +# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does
103 +# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 charmap.
104 +# This may be used to work around the quirky open() behavior of python3.
105 +python_export_utf8_locale() {
106 + debug-print-function ${FUNCNAME} "${@}"
107 +
108 + if [[ $(locale charmap) != UTF-8 ]]; then
109 + if [[ -n ${LC_ALL} ]]; then
110 + ewarn "LC_ALL is set to a locale with a charmap other than UTF-8."
111 + ewarn "This may trigger build failures in some python packages."
112 + return 1
113 + fi
114 +
115 + # Try English first, then everything else.
116 + local lang locales="en_US.UTF-8 $(locale -a)"
117 +
118 + for lang in ${locales}; do
119 + if [[ $(LC_CTYPE=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
120 + export LC_CTYPE=${lang}
121 + return 0
122 + fi
123 + done
124 +
125 + ewarn "Could not find a UTF-8 locale. This may trigger build failures in"
126 + ewarn "some python packages. Please ensure that a UTF-8 locale is listed in"
127 + ewarn "/etc/locale.gen and run locale-gen."
128 + return 1
129 + fi
130 +
131 + return 0
132 +}
133 +
134 _PYTHON_UTILS_R1=1
135 fi