Re: Writing a simple python recipe to add pydevd support to a personnal layer #yocto #zeus #make python recipe #yocto #zeus #make


Maciej Pijanowski
 


On 04.12.2020 11:37, anthony.marchand@... wrote:
Hello everyone,

I have to add a python module named "pydevd" in my personnal image machine.
Pydevd is a python module that can be used for remote debbuging with the Ecipse IDE.

So normally, I used to go to the site: http://layers.openembedded.org/layerindex/branch/zeus/recipes to see what are the recipes available for the yocto version I use (zeus version), and then, I add the name of the recipe to my image in:

IMAGE_INSTALL += " \
         recipe_1\
         recipe_2\
         ...
"

As the recipe for the python 3 module: "pydevd" does not exists in zeus branch, I decided to create one by observing their structures and how python recipes are made.
So there is my recipe for the latest version of pydevd I got from python.org:

------------------------------------ pydevd_2.1.0.bb -------------------------------------------------------
SUMMARY = "Pydevd, a python module for eclipse remote debugging"
HOMEPAGE = "https://pypi.org/project/pydevd"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=30b3836521b3d65bef598bbc358a3afa"

SRC_URI = "https://files.pythonhosted.org/packages/51/8c/4ebdb28a4b2f8cedc17a2fc68c38c545b12c2a861ac2bbd3cd5fdb5971a7/pydevd-2.1.0.tar.gz"
SRC_URI[md5sum] = "74f4336ce09c5fab228a8ff4285e519a"
SRC_URI[sha256sum] = "9f76aa4f82e43faba7c243d4c9678eb93e96848ba1e5dba61054bec2794e994b"

RDEPENDS_${PN}_class-target += "\
    ${PYTHON_PN}-threading \
"

inherit pypi setuptools3 ptest
BBCLASSEXTEND = "native nativesdk"

RDEPENDS_${PN}-ptest += " \
        ${PYTHON_PN}-pytest \
"

fakeroot do_install_test() {

        install -d ${D}${PTEST_PATH}/pydevd/tests
        cp -rf ${S}/pydevd/* ${D}/pydevd/
        cp -f ${S}/README.rst ${D}${PTEST_PATH}/
}
-------------------------------------------------------------------------------------------

So I'm sure about md5 checksum, Licence and SRC_URI, but from the line: "RDEPENDS_${PN}_class-target" to the end, I'm not sure about what I'm doing :-)
After a test of compilation with the command "bitbake pydevd", bitbake seems to parse and extract the tar.gz package well, but I have an error at the end when it tried to do install.
I suggest to start with recipetool rather than starting from scratch:
https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#new-recipe-creating-the-base-recipe-using-recipetool

For most python modules it should **just work**.

Compare the output of recipetool with what you have done manually and start from there.

My goal is simply to extract the content of the pydevd.tar.gz and installed it on my target path: "/usr/lib/python3.7/site-packages"

When I do that manually on my target machine (by extracting the tar.gz in "/usr/lib/python3.7/site-packages" ), it works fine and python can import the module pydevd. I would like to do the same thing with a yocto recipe, but i've never made any recipes, I just know the basic theory about it.


Does someone know or have ideas about how can I do that? Maybe it's not as simple as that, but as I'm pretty new, I don't realize the level of difficulty it represents.

Thanks for all and best reguards.


-- 
Maciej Pijanowski
Embedded Firmware Team Leader
GPG: 9963C36AAC3B2B46
https://3mdeb.com | @3mdeb_com

Join yocto@lists.yoctoproject.org to automatically receive all group messages.