Skip to contentSkip to conversation

Include additional python modules...

DISCUSSION Ahmed El-Madhoun (aelmadho) 1 participant 1 message Nov 19, 2015

lore
Share & tools
lore
#0 lore raw

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: <[email protected]<mailto:[email protected]>> on behalf of aelmadho <[email protected]<mailto:[email protected]>>
Date: Wednesday, November 18, 2015 at 11:37 AM
To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
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