Search code examples
pythonpython-2.7bitbakeopenembedded

How do I add python-contextlib to python_2.7.3.bbappend?


In my custom-layer/recipes-devtools/python/python_2.7.3.bbappend, I have the following contents

PROVIDES+="${PN}-contextlib "

PACKAGES+="${PN}-contextlib "

SUMMARY_${PN}-contextlib="Python utilities for with-statementcontexts."
RDEPENDS_${PN}-contextlib="${PN}-core "
FILES_${PN}-contextlib="${libdir}/python2.7/contextlib.* "

RDEPENDS_${PN}-modules+= "${PN}-contextlib "

When I execute bitbake -f python-contextlib - nothing fails.

When I add python-contextlib as a RDEPEND within another recipe, it fails as in “no package provides python-contextlib” when the do_rootfs task is executed.

When I build python, I do see the file contextlib.py exists when I go into python devshell. So, it seems like the bbappend file is correctly being picked up. The bitbake-layers show-appends also confirms that the bbappend file is getting picked up.

How can I fix this issue?


Solution

  • Your first bitbake is failing because bitbake takes recipe names, not runtime package names.

    If you really want contextlib split out into a separate package then I'd just cherry-pick 27dbacdb88ee3e79f4c95a779d8a7e8c5c8f941d and b6b9df15a630605619bff060d5073272685058d6 (from oe-core).

    The problem here is likely ordering, you're putting PN-contextlib after the manifest inc has taken everything else. Use PACKAGES =+ to prepend instead of append.

    Note that contextlib is packaged without this append, likely in the python-misc package, so I do wonder why so many people desperately want it split out.