From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/6] support/graph-depends: use argparse to parse argv[]
Date: Mon, 14 Apr 2014 21:46:35 +0200 [thread overview]
Message-ID: <20140414194635.GA3255@free.fr> (raw)
In-Reply-To: <CAHXCMMJzSH9vzEhCnQaTTLvirrY-xJVjd_7NpJUyU09DuF3Naw@mail.gmail.com>
Samuel, All,
On 2014-04-14 21:20 +0200, Samuel Martin spake thusly:
> On Sun, Apr 13, 2014 at 10:42 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> > From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >
> > Currently, we are using a crude, ad-hoc parsing of argv[].
> > This is a limiting factor to adding new options.
> >
> > Use argparse instead, and introduce a single argument for now:
> > --package, -p PACKAGE
>
> Is an option really needed for package? I mean it could be the
> remaining argument(s); or maybe it does not fit in developments you
> have in mind ;).
It's just that I don't know how to do that with Python's argparse.
I just duplicated the code in:
support/scripts/graph-nuild-time
[--SNIP--]
> > diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends
> > index ac24086..fc3cadd 100755
> > --- a/support/scripts/graph-depends
> > +++ b/support/scripts/graph-depends
> > @@ -31,14 +32,16 @@ PKG_MODE = 2
> >
> > mode = 0
> >
> > -if len(sys.argv) == 1:
> > +parser = argparse.ArgumentParser(description="Graph pacakges dependencies")
> > +parser.add_argument("--package", '-p', metavar="PACKAGE",
>
> Any reason to mixed double and single quotes?
Again, I just duplicated what was already in:
support/scripts/graph-build-time
> > + help="Graph the dependencies of PACKAGE")
> > +args = parser.parse_args()
> > +
> > +if args.package == None:
>
> In Python, None is a singleton, and it is recommended to use "is" or
> "is not" for testing them [1].
OK, I'll send an follow-up patch to fix that.
Thanks!
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2014-04-14 19:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-13 20:42 [Buildroot] [PATCH 0/6] Misc graphs enhancements (branch yem/graphs) Yann E. MORIN
2014-04-13 20:42 ` [Buildroot] [PATCH 1/6] Makefile: rename non-user-facing variable Yann E. MORIN
2014-04-14 19:18 ` Samuel Martin
2014-04-13 20:42 ` [Buildroot] [PATCH 2/6] support/graph-depends: use argparse to parse argv[] Yann E. MORIN
2014-04-14 19:20 ` Samuel Martin
2014-04-14 19:46 ` Yann E. MORIN [this message]
2014-04-13 20:42 ` [Buildroot] [PATCH 3/6] support/graph-depends: add option to limit the depth of the graph Yann E. MORIN
2014-04-14 19:29 ` Samuel Martin
2014-04-14 19:48 ` Yann E. MORIN
2014-04-13 20:42 ` [Buildroot] [PATCH 4/6] manual: document BR2_GRAPH_DEPTH Yann E. MORIN
2014-04-14 19:31 ` Samuel Martin
2014-04-13 20:42 ` [Buildroot] [PATCH 5/6] support/graph-depends: don't show toolchain dependency for all packages Yann E. MORIN
2014-04-14 19:00 ` Thomas Petazzoni
2014-04-14 19:03 ` Thomas Petazzoni
2014-04-14 19:42 ` Samuel Martin
2014-04-13 20:42 ` [Buildroot] [PATCH 6/6] graphs: make graphs with lots of packages nicer to look at Yann E. MORIN
2014-04-14 20:15 ` [Buildroot] [PATCH 0/6] Misc graphs enhancements (branch yem/graphs) Thomas Petazzoni
2014-04-14 20:22 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140414194635.GA3255@free.fr \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox