xref: /openbmc/openbmc/poky/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst (revision c9537f57ab488bf5d90132917b0184e2527970a5)
1.. SPDX-License-Identifier: CC-BY-2.5
2
3=================
4Library Functions
5=================
6
7|
8
9This chapter lists common library functions available under the ``lib/``
10directory in BitBake.
11
12These functions can be used in recipes or configuration files with
13:ref:`inline-Python <bitbake-user-manual/bitbake-user-manual-metadata:Inline
14Python Variable Expansion>` or :ref:`Python
15<bitbake-user-manual/bitbake-user-manual-metadata:BitBake-Style Python
16Functions>` functions.
17
18Logging utilities
19=================
20
21Different logging utilities can be used from Python code in recipes or
22configuration files.
23
24The strings passed below can be formatted with ``str.format()``, for example::
25
26   bb.warn("Houston, we have a %s", "bit of a problem")
27
28Formatted string can also be used directly::
29
30   bb.error("%s, we have a %s" % ("Houston", "big problem"))
31
32Python f-strings may also be used::
33
34   h = "Houston"
35   bb.fatal(f"{h}, we have a critical problem")
36
37.. automodule:: bb
38   :members:
39      debug,
40      error,
41      erroronce,
42      fatal,
43      note,
44      plain,
45      verbnote,
46      warn,
47      warnonce,
48
49``bb.utils``
50============
51
52.. automodule:: bb.utils
53   :members:
54   :exclude-members:
55      LogCatcher,
56      PrCtlError,
57      VersionStringException,
58      better_compile,
59      better_exec,
60