poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
Antonin Godard a035cd4718 bitbake: doc: add a new Library Functions document
Add a new document to the BitBake user manual that automatically
documents the library functions from their docstrings. The docstrings
can be formatted in reStructuredText.

Here logging utilities and the bb.utils module is documented. Some
members of the utils module were deliberately excluded as their usage is
most likely only internal to BitBake.

Fixes [YOCTO #9612]

(Bitbake rev: 0a711949acc2696f32a61c591ee3ea37041acb91)

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-04-24 11:53:00 +01:00

60 lines
1.3 KiB
ReStructuredText

.. SPDX-License-Identifier: CC-BY-2.5
=================
Library Functions
=================
|
This chapter lists common library functions available under the ``lib/``
directory in BitBake.
These functions can be used in recipes or configuration files with
:ref:`inline-Python <bitbake-user-manual/bitbake-user-manual-metadata:Inline
Python Variable Expansion>` or :ref:`Python
<bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python
Functions>` functions.
Logging utilities
=================
Different logging utilities can be used from Python code in recipes or
configuration files.
The strings passed below can be formatted with ``str.format()``, for example::
bb.warn("Houston, we have a %s", "bit of a problem")
Formatted string can also be used directly::
bb.error("%s, we have a %s" % ("Houston", "big problem"))
Python f-strings may also be used::
h = "Houston"
bb.fatal(f"{h}, we have a critical problem")
.. automodule:: bb
:members:
debug,
error,
erroronce,
fatal,
note,
plain,
verbnote,
warn,
warnonce,
``bb.utils``
============
.. automodule:: bb.utils
:members:
:exclude-members:
LogCatcher,
PrCtlError,
VersionStringException,
better_compile,
better_exec,