Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Mike Gilbert <floppym@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] install.py: ignore -Z / --context
Date: Thu, 07 Nov 2019 20:31:58
Message-Id: 6cac3639-992b-89d2-069e-8f5a5d5e2ee6@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] install.py: ignore -Z / --context by Mike Gilbert
1 On 11/7/19 10:22 AM, Mike Gilbert wrote:
2 > The --context option accepts an optional argument, but only if it is
3 > passed via --context=arg. The argparse module does not deal with this
4 > properly.
5 >
6 > To work around this, have argparse ignore this option, and filter out
7 > any remaining arguments that start with a hyphen.
8 >
9 > Bug: https://bugs.gentoo.org/699548
10 > Signed-off-by: Mike Gilbert <floppym@g.o>
11 > ---
12 > bin/install.py | 8 +-------
13 > 1 file changed, 1 insertion(+), 7 deletions(-)
14 >
15 > diff --git a/bin/install.py b/bin/install.py
16 > index d3789ed96..e56475ff1 100755
17 > --- a/bin/install.py
18 > +++ b/bin/install.py
19 > @@ -111,12 +111,6 @@ def parse_args(args):
20 > action="store_true",
21 > dest="no_target_directory"
22 > )
23 > - parser.add_argument(
24 > - "--context",
25 > - "-Z",
26 > - action="store",
27 > - dest="context"
28 > - )
29 > parser.add_argument(
30 > "--verbose",
31 > "-v",
32 > @@ -147,7 +141,7 @@ def parse_args(args):
33 >
34 > opts = parsed_args[0]
35 > files = parsed_args[1]
36 > - files = [f for f in files if f != "--"] # filter out "--"
37 > + files = [f for f in files if not f.startswith("-")] # filter unknown options
38 >
39 > return (opts, files)
40 >
41 >
42
43 Technically, shouldn't we pass through any "files" that start with "-"
44 and come after the "--" separator?
45 --
46 Thanks,
47 Zac

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-portage-dev] [PATCH] install.py: ignore -Z / --context Mike Gilbert <floppym@g.o>