yoctobitbake

Add python project based on pyproject.toml to yocto image


I'm putting together a recipe that's supposed to add amqtt to my image (https://github.com/Yakifo/amqtt). The project only comes with a pyproject.toml but lacks a setup.py. Thus, bitbake is complaining that setup.py cannot be found I'm on branch dunfell and these are the most relevant parts of my recipe:

HOMEPAGE = "https://github.com/Yakifo/amqtt"

SRC_URI = "git://github.com/Yakifo/amqtt;protocol=https"

SRCREV = "4beb912c2a0d58d66140ce68b6a31991c2c48b30"

S = "${WORKDIR}/git"

inherit setuptools3 pypi distutils

Your input is highly appreciated.


Solution

  • The solution by adding a do_configure:prepend() function worked for me, with one exception.

    If you're going to have more than one recipe with this workaround, they will conflict in the site-packages directory, since setup() doesn't know what to call them.

    I'd recommend populating at least some of the arguments to the setup() function. Your recipe already has PYPI_PACKAGE, LICENSE and PV defined, so they're easy to add.

    do_configure:prepend() {
    cat > ${S}/setup.py <<-EOF
    from setuptools import setup
    
    setup(
           name="${PYPI_PACKAGE}",
           version="${PV}",
           license="${LICENSE}",
    )
    EOF
    }