[OE-core] [PATCH] oeqa/oetest.py: add better pkg. search for hasPackage()

Burton, Ross ross.burton at intel.com
Fri Aug 21 12:57:26 UTC 2015


On 21 August 2015 at 12:37, Costin Constantin <costin.c.constantin at intel.com
> wrote:

> +        for item in oeTest.tc.pkgmanifest.split('\n'):
> +            if re.match(pkg, item):
> +                return True
> +                break
> +        else:
> +            return False
>

I just had to look up the for/else syntax as I'd never seen it before.
Whilst this works, the fact that the break statement is never executed (as
it returns beforehand) makes it a bit odd.  Personally I'd have done:

for item in ...:
  if re.match():
    return True
return False

Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20150821/24434635/attachment-0002.html>


More information about the Openembedded-core mailing list