[yocto] Include additional python modules...

Ahmed El-Madhoun (aelmadho) aelmadho at cisco.com
Wed Nov 18 16:18:40 PST 2015


Despite inheriting python native in my bbclass, I still could not see the python-pyyaml-native libraries/package, so I had to do this:


   import os

    os.sys.path.append(os.path.join(d.getVar('STAGING_DIR_NATIVE', True),
        d.getVar('PYTHON_SITEPACKAGES_DIR', True)[1::]))

   import yaml



From: <yocto-bounces at yoctoproject.org<mailto:yocto-bounces at yoctoproject.org>> on behalf of aelmadho <aelmadho at cisco.com<mailto:aelmadho at cisco.com>>
Date: Wednesday, November 18, 2015 at 11:37 AM
To: "yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>" <yocto at yoctoproject.org<mailto:yocto at yoctoproject.org>>
Subject: [yocto] Include additional python modules...

Hi All,

I am wondering if anything special needs to be done to provide additional python packages in python functions within recipes, for instance, in an image.bbclass extension, I have the following python function:

python do_write_yaml() {

    Import yaml

}

This fails indicating no such module, but when I use devshell, the os.sys.path seems to include the right path for native sysroot, and I have my "DEPENDS += python-pyyaml-native", however, within the python functions in the recipes, it is not able to see the pyyaml package, do I need to add the path manually to os.sys.path? For instance, how is "bb" and "oe" are always included in the PATH, and how do we make other python packages available in the path for extending existing functionality through python modules?

Any help is greatly appreciated.

Thanks,
Ahmed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20151119/904e9056/attachment.html>


More information about the yocto mailing list