[oe] Conditional Expressions in Python

Dr. Michael Lauer mickey at vanille-media.de
Sun Sep 9 12:32:37 UTC 2007


Guys,

I vote for rewriting our conditional expressions hack in .bb files:

DEPENDS = "${@['virtual/${TARGET_PREFIX}gcc-initial','virtual/${TARGET_PREFIX}gcc']['nptl' in '${GLIBC_ADDONS}']}"

Since Python 2.5, this can be written as:

DEPENDS = "${@'virtual/${TARGET_PREFIX}gcc' if 'nptl' in '${GLIBC_ADDONS}' else 'virtual/${TARGET_PREFIX}gcc-initial'}

which parses faster and is much more clear and concise. IIRC the
resulting bytecode is also faster since there is no need to construct,
access, and destroy temporary lists.

Regards,

:M:
-- 
Michael 'Mickey' Lauer | IT-Freelancer | http://www.vanille-media.de





More information about the Openembedded-devel mailing list