[OE-core] [PATCH 1/2 V2] oe/utils.py: Add vartrue()
Richard Purdie
richard.purdie at linuxfoundation.org
Wed Sep 5 19:31:25 UTC 2018
On Wed, 2018-09-05 at 16:11 +0800, Robert Yang wrote:
> On 09/05/2018 03:33 PM, Peter Kjellerstedt wrote:
> > >
> > Put it together with ifelse() and conditional() instead, where it
> > better
> > belongs.
> >
> > You can also implement it as:
> >
> > def vartrue(var, iftrue, iffalse, d):
> > import oe.types
> > return oe.utils.ifelse(oe.types.boolean(d.getVar(var), iftrue,
> > iffalse):
>
> Then we need import oe.utils, and I don't think that it's easier to
> read than:
>
> +
> +def vartrue(var, iftrue, iffalse, d):
> + import oe.types
> + if oe.types.boolean(d.getVar(var)):
> + return iftrue
> + else:
> + return iffalse
I think Robert's version is easier to read, the addition of the other
function doesn't really add much. It probably should live alongside the
other varients in the file though.
Cheers,
Richard
More information about the Openembedded-core
mailing list