Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] xpak-helper: rewrite to rely more on argparse
Date: Mon, 02 Nov 2015 17:06:26
Message-Id: 56379805.1030305@gentoo.org
In Reply to: Re: [gentoo-portage-dev] [PATCH] xpak-helper: rewrite to rely more on argparse by Mike Frysinger
1 On 11/02/2015 08:52 AM, Mike Frysinger wrote:
2 > On 01 Nov 2015 09:36, Zac Medico wrote:
3 >> In order to handle python3 with arguments containing UTF-8 characters
4 >> (in ${PKGDIR}) and a mis-matched sys.getfilesystemencoding() value, it's
5 >> safest to decode the arguments like chmod-lite.py does.
6 >
7 > it seems wrong that we have incomplete coverage here.
8 > some tools do it and some do not.
9
10 Yeah, complete coverage would be nice. Most if not all of the python
11 helpers that are called from the ebuild environment already use this
12 method to decode filename arguments (dohtml.py was only fixed recently,
13 for bug 561846).
14
15 >> We should create
16 >> a function for this code which is also duplicated in install.py:
17 >
18 > you mean portage._decode_argv ?
19
20 Yes, I forgot about that function.
21
22 > what if we create a new module like "commandline" that provides an
23 > ArgumentParser interface that takes care of this for us ?
24 > -mike
25
26 That sounds good. After it decodes the arguments, it should decode them
27 as UTF-8 with errors='strict', and exit the program immediately if it
28 triggers a UnicodeDecodeError.
29 --
30 Thanks,
31 Zac

Replies