On Thu, Nov 7, 2019 at 3:31 PM Zac Medico <zmed...@gentoo.org> wrote:
>
> On 11/7/19 10:22 AM, Mike Gilbert wrote:
> > The --context option accepts an optional argument, but only if it is
> > passed via --context=arg. The argparse module does not deal with this
> > properly.
> >
> > To work around this, have argparse ignore this option, and filter out
> > any remaining arguments that start with a hyphen.
> >
> > Bug: https://bugs.gentoo.org/699548
> > Signed-off-by: Mike Gilbert <flop...@gentoo.org>
> > ---
> >  bin/install.py | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/bin/install.py b/bin/install.py
> > index d3789ed96..e56475ff1 100755
> > --- a/bin/install.py
> > +++ b/bin/install.py
> > @@ -111,12 +111,6 @@ def parse_args(args):
> >               action="store_true",
> >               dest="no_target_directory"
> >       )
> > -     parser.add_argument(
> > -             "--context",
> > -             "-Z",
> > -             action="store",
> > -             dest="context"
> > -     )
> >       parser.add_argument(
> >               "--verbose",
> >               "-v",
> > @@ -147,7 +141,7 @@ def parse_args(args):
> >
> >       opts  = parsed_args[0]
> >       files = parsed_args[1]
> > -     files = [f for f in files if f != "--"] # filter out "--"
> > +     files = [f for f in files if not f.startswith("-")] # filter unknown 
> > options
> >
> >       return (opts, files)
> >
> >
>
> Technically, shouldn't we pass through any "files" that start with "-"
> and come after the "--" separator?

Ah, yes. I will revise it.

Reply via email to