Search code examples
pythonpython-3.xcommand-line-interfaceyoctobitbake

Bitbake Recipe for a python3 repository that provides a CLI as a binary


I have some simple python3 scripts that I packaged in such a way that upon pip install . within the repository one can use the scripts within the bin folder as a CLI e.g.

 $ gpsinflux # execute the script as cli

source

gpsinflux repository.

Workflow

  1. I used devtool add gpsinflux url_of_repo

  2. I already managed to add influxdb-python as a recipe based on my findings in my previous SE Query regarding python application on yocto

  3. Edit the recipe to add RDEPENDS_PN

However do I need to mention within the recipe that I want the script in the bin folder from my repository to be installed in say, /usr/bin folder or will the recipe do that automatically?


Solution

  • Checked on Target Hardware

    One does not require to perform do_install() at all. If the setup.py does have packages=[bin/script1] then upon sucessfully baking the recipe and adding the recipe to you Root Filesystem will automatically provide your script1 in /usr/bin/ folder.

    Cross Reference

    I looked into python-awscli example in meta-iot-cloud and there it is no mention of do_install()

    in the same repository if one needs to port python2.7 to python3 one can use sed to change the shebang of the bin/script1 using do_install_append()