Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 09/11] support/scripts: introduce a symbol formatter to generate package lists
Date: Wed, 4 Jun 2014 19:48:27 +0200	[thread overview]
Message-ID: <20140604174827.GD3325@free.fr> (raw)
In-Reply-To: <20140603061040.GA8994@free.fr>

Samuel, All,

On 2014-06-03 08:10 +0200, Yann E. MORIN spake thusly:
> On 2014-06-03 00:53 +0200, Samuel Martin spake thusly:
> > On Mon, Jun 2, 2014 at 11:06 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote:
> [--SNIP--]
> > > +    def _format_symbol_prompt_location(self, what=None, symbol=None, root=None,
> > > +                                             enable_choice=False, header=None,
> > > +                                             get_label_func=lambda x: x):
> > > +        if what is None:
> > > +            raise Exception("Don't know what to format")
> > > +
> > > +        if what == "layout":
> > > +            return ( "100%", "^1,4" )
> > > +
> > > +        if what == "header":
> > > +            if hasattr(root, "get_title"):
> > > +                loc_label = get_symbol_parents(root, None, enable_choice=enable_choice)
> > > +                loc_label += [root.get_title(), "..."]
> > > +            else:
> > > +                loc_label = ["Location"]
> > > +            return "| {0:<40} <| {1}\n".format(header, " -> ".join(loc_label))
> > > +
> > > +        if what == "symbol":
> > > +            parents = get_symbol_parents(symbol, root, enable_choice)
> > > +            return "| {0:<40} <| {1}\n".format(get_label_func(symbol),
> > > +                                               " -> ".join(parents))
> > > +
> > > +        raise Exception("Don't know how to format '%s'" % str(what))
> > 
> > Raising an exception if 'what' is None, and raising an exception when
> > it  has an invalid value seems a bit overkill to me... ;-)
> > 
> > I would drop the None-check, and make the exception message more
> > helpful in invalid case:
> > 
> >   message = "Invalid argument 'what': '%s'\n" % str(what)
> >   message += "Allowed values are: 'layout', 'header' and 'symbol'"
> >   raise Exception(message)
> 
> But then, what happens if 'what' is in fact None, and we compare it to a
> string? Does Python automagically convert None to an empty string
> (whatever that might be in Python)?
> 
> OK, I'll give it a shot...

OK, it looks like it is working. 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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-06-04 17:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 21:06 [Buildroot] [PATCH 0/11 v2] Add list of virtual packages to manual (branch yem/manual) Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 01/11] package/cryptodev: make it behave more like other virtual packages Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 02/11] package/jpeg: " Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 03/11] package/mesa3d: rename the prompt Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 04/11] support/scripts: prepare expanding the packages lists Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 05/11] support/scripts: document args to _is_package() in gen-manual-lists Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 06/11] support/scripts: prepare handling virtual packages in generated lists Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 07/11] support/scripts: do not display " Yann E. MORIN
2014-06-02 22:53   ` Samuel Martin
2014-06-04 17:47     ` Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 08/11] support/scripts: who's responsible to decide what is a package Yann E. MORIN
2014-06-02 21:06 ` [Buildroot] [PATCH 09/11] support/scripts: introduce a symbol formatter to generate package lists Yann E. MORIN
2014-06-02 22:53   ` Samuel Martin
2014-06-03  6:10     ` Yann E. MORIN
2014-06-04 17:48       ` Yann E. MORIN [this message]
2014-06-02 21:06 ` [Buildroot] [PATCH 10/11] support/scripts: generate a list of virtual packages Yann E. MORIN
2014-06-02 22:57   ` Samuel Martin
2014-06-02 21:06 ` [Buildroot] [PATCH 11/11] docs/manual: add the virtual packages list Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2014-06-08 14:15 [Buildroot] [PATCH 0/11 v3] Add list of virtual packages to manual (branch yem/manual) Yann E. MORIN
2014-06-08 14:15 ` [Buildroot] [PATCH 09/11] support/scripts: introduce a symbol formatter to generate package lists 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=20140604174827.GD3325@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