Gentoo Archives: gentoo-portage-dev

From: Mike Gilbert <floppym@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting
Date: Wed, 06 Aug 2014 01:00:43
Message-Id: CAJ0EP42XiNcvKpXvY9xgoxYb0iVk+xnp6-2QB4vqwn_sy0B07g@mail.gmail.com
In Reply to: Re: [gentoo-portage-dev] [PATCH] emerge: Don't die when the user has an invalid locale setting by Alec Warner
1 On Tue, Aug 5, 2014 at 3:23 PM, Alec Warner <antarus@g.o> wrote:
2 > On Mon, Aug 4, 2014 at 12:45 PM, Mike Gilbert <floppym@g.o> wrote:
3 >>
4 >> ---
5 >> pym/_emerge/main.py | 5 ++++-
6 >> 1 file changed, 4 insertions(+), 1 deletion(-)
7 >>
8 >> diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
9 >> index 1a920f7..722da84 100644
10 >> --- a/pym/_emerge/main.py
11 >> +++ b/pym/_emerge/main.py
12 >> @@ -999,7 +999,10 @@ def emerge_main(args=None):
13 >> args = portage._decode_argv(args)
14 >>
15 >> # Use system locale.
16 >> - locale.setlocale(locale.LC_ALL, '')
17 >> + try:
18 >> + locale.setlocale(locale.LC_ALL, '')
19 >> + except locale.Error as e:
20 >> + print(e)
21 >
22 >
23 > Portage has its own output functions (writemsg?)
24 > You need to decide if this should be printed even if -q is passed, should it
25 > be colorized, etc...
26 >
27 > -A
28
29 I would appreciate it if someone more familiar with portage could make
30 that decision and replace the print(e) with something better. Please
31 don't wait for me to familiarize myself with the code to fix this
32 rather annoying behavior.