Gentoo Archives: gentoo-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Change python_export_utf8_locale to deal with LC_ALL=C
Date: Mon, 30 Nov 2015 21:40:20
Message-Id: 1448919604-9820-1-git-send-email-floppym@gentoo.org
1 Paludis sets LC_ALL=C to ensure a 'sane' build environment.
2 We only want to override LC_CTYPE, so we break LC_ALL into separate
3 LC_* overrides and set LC_ALL to blank.
4 ---
5 eclass/python-utils-r1.eclass | 22 +++++++++++++++-------
6 1 file changed, 15 insertions(+), 7 deletions(-)
7
8 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
9 index b163fd8..024e093 100644
10 --- a/eclass/python-utils-r1.eclass
11 +++ b/eclass/python-utils-r1.eclass
12 @@ -1189,19 +1189,27 @@ python_export_utf8_locale() {
13 type locale >/dev/null || return 0
14
15 if [[ $(locale charmap) != UTF-8 ]]; then
16 - if [[ -n ${LC_ALL} ]]; then
17 - ewarn "LC_ALL is set to a locale with a charmap other than UTF-8."
18 - ewarn "This may trigger build failures in some python packages."
19 - return 1
20 - fi
21 -
22 # Try English first, then everything else.
23 local lang locales="en_US.UTF-8 $(locale -a)"
24
25 for lang in ${locales}; do
26 - if [[ $(LC_CTYPE=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
27 + if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
28 if _python_check_locale_sanity "${lang}"; then
29 export LC_CTYPE=${lang}
30 + if [[ -n ${LC_ALL} ]]; then
31 + export LC_NUMERIC=${LC_ALL}
32 + export LC_TIME=${LC_ALL}
33 + export LC_COLLATE=${LC_ALL}
34 + export LC_MONETARY=${LC_ALL}
35 + export LC_MESSAGES=${LC_ALL}
36 + export LC_PAPER=${LC_ALL}
37 + export LC_NAME=${LC_ALL}
38 + export LC_ADDRESS=${LC_ALL}
39 + export LC_TELEPHONE=${LC_ALL}
40 + export LC_MEASUREMENT=${LC_ALL}
41 + export LC_IDENTIFICATION=${LC_ALL}
42 + export LC_ALL=
43 + fi
44 return 0
45 fi
46 fi
47 --
48 2.6.3