[yocto] default variables in a python task/function

Joshua Immanuel josh at hipro.co.in
Wed Jun 20 08:46:11 PDT 2012


Hello,

Considering the following code snippet variants of a recipe which does
the same job, I would like to clarify certain doubts regarding this.

python __anonymous () {
        pn_split = d.getVar('PN', True).split('-')
        ...
}

python __anonymous () {
        import bb
        pn_split = bb.data.getVar('PN', d, True).split('-')
        ...
}

In some .bbclass, 'bb' library is used without importing it. I find that
the 'd' variable is an instance of DataSmart class in the bitbake
library. Will this 'bb' and 'd' variables be available to all python
tasks and functions? 

I also find that in global python functions such as 'get_imagecmds'
defined in image_types.bbclass 'd' is got as a parameter. Can someone
explain when the 'd' will be initialized? Will the instance of DataSmart
(i.e the variable 'd') in bbclass differ from that of the recipe which
inherited that class? In bitbake manual, example of global python
functions are shown as accepting 'bb' and 'd' variables as its
parameters. Can someone explain the right way of doing this.

Thank you

-- 
Joshua Immanuel
HiPro IT Solutions Private Limited
http://hipro.co.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20120620/d0e6e805/attachment.pgp>


More information about the yocto mailing list