summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual/bitbake-user-manual-library-functions.rst
blob: 09e353945bb66c7e02123ee4925e3b84c63b045f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
.. 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,