From: Antonin Godard <antonin.godard@bootlin.com>
To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
docs@lists.yoctoproject.org,
Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH 2/4] lib/bb: format and improve logging docstrings
Date: Fri, 18 Apr 2025 17:15:26 +0200 [thread overview]
Message-ID: <20250418-library-functions-v1-2-3bbb836149d7@bootlin.com> (raw)
In-Reply-To: <20250418-library-functions-v1-0-3bbb836149d7@bootlin.com>
Format the docstrings of the utils modules to be automatically
documented with the autodoc Sphinx extensions.
Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
lib/bb/__init__.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 70 insertions(+), 6 deletions(-)
diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index 566835573..c95c91a4c 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -129,9 +129,25 @@ sys.modules['bb.fetch'] = sys.modules['bb.fetch2']
# Messaging convenience functions
def plain(*args):
+ """
+ Prints a message at "plain" level (higher level than a ``bb.note()``).
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.plain(''.join(args))
def debug(lvl, *args):
+ """
+ Prints a debug message.
+
+ Arguments:
+
+ - ``lvl``: debug level. Higher value increases the debug level
+ (determined by ``bitbake -D``).
+ - ``args``: one or more strings to print.
+ """
if isinstance(lvl, str):
mainlogger.warning("Passed invalid debug level '%s' to bb.debug", lvl)
args = (lvl,) + args
@@ -139,33 +155,81 @@ def debug(lvl, *args):
mainlogger.bbdebug(lvl, ''.join(args))
def note(*args):
+ """
+ Prints a message at "note" level.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.info(''.join(args))
-#
-# A higher prioity note which will show on the console but isn't a warning
-#
-# Something is happening the user should be aware of but they probably did
-# something to make it happen
-#
def verbnote(*args):
+ """
+ A higher priority note which will show on the console but isn't a warning.
+
+ Use in contexts when something is happening the user should be aware of but
+ they probably did something to make it happen.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.verbnote(''.join(args))
#
# Warnings - things the user likely needs to pay attention to and fix
#
def warn(*args):
+ """
+ Prints a warning message.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.warning(''.join(args))
def warnonce(*args):
+ """
+ Prints a warning message like ``bb.warn()``, but only prints the message
+ once.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.warnonce(''.join(args))
def error(*args, **kwargs):
+ """
+ Prints an error message.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.error(''.join(args), extra=kwargs)
def erroronce(*args):
+ """
+ Prints an error message like ``bb.error()``, but only prints the message
+ once.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.erroronce(''.join(args))
def fatal(*args, **kwargs):
+ """
+ Prints an error message and stops the BitBake execution.
+
+ Arguments:
+
+ - ``args``: one or more strings to print.
+ """
mainlogger.critical(''.join(args), extra=kwargs)
raise BBHandledException()
--
2.47.0
next prev parent reply other threads:[~2025-04-18 15:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 15:15 [PATCH 0/4] Document library functions Antonin Godard
2025-04-18 15:15 ` [PATCH 1/4] utils: format and improve docstrings Antonin Godard
2025-04-22 16:24 ` [bitbake-devel] " Quentin Schulz
2025-04-18 15:15 ` Antonin Godard [this message]
2025-04-22 16:49 ` [bitbake-devel] [PATCH 2/4] lib/bb: format and improve logging docstrings Quentin Schulz
2025-04-18 15:15 ` [PATCH 3/4] doc: add a new Library Functions document Antonin Godard
2025-04-22 16:49 ` [bitbake-devel] " Quentin Schulz
2025-04-18 15:15 ` [PATCH 4/4] doc: bitbake-user-manual-metadata: provide link to new doc Antonin Godard
2025-04-24 10:54 ` [bitbake-devel] [PATCH 0/4] Document library functions Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250418-library-functions-v1-2-3bbb836149d7@bootlin.com \
--to=antonin.godard@bootlin.com \
--cc=bitbake-devel@lists.openembedded.org \
--cc=docs@lists.yoctoproject.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.