[oe] Use python in variable assigment of a recipe

Paul Eggleton paul.eggleton at linux.intel.com
Tue Feb 28 13:28:00 UTC 2012


On Tuesday 28 February 2012 13:11:08 Steffen Sledz wrote:
> Because i'm working with oe-classic i tried this (found in some other
> examples):
> 
>   MYVAR = "${@my_func()}"
> 
>   def my_func():
>       bbpath = os.path.dirname(bb.data.getVar('FILE',d,1))
>       ...
> 
> But this leads to an error:
> 
>   NameError: global name 'd' is not defined

If you pass in d it should work, i.e.:

   MYVAR = "${@my_func(d)}"
 
   def my_func(d):
       bbpath = os.path.dirname(bb.data.getVar('FILE',d,1))

BTW, d.getVar() should work fine in OE-Classic (or to be fully correct, it 
should work fine with older versions of bitbake).

Cheers,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre




More information about the Openembedded-devel mailing list