diff mbox series

[v2,1/4] bitbake-setup: define a color_enabled() helper function

Message ID 20260218-improve-bbsetup-readability-v2-1-351584e5df9c@bootlin.com
State New
Headers show
Series bitbake-setup: Improve readability | expand

Commit Message

Antonin Godard Feb. 18, 2026, 1:15 p.m. UTC
This will be re-used in the next commits to force subprocess commands to
color their outputs, as passing --color=auto in them always render
without coloring.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 bin/bitbake-setup | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 927c03a1033..3e17e631bfb 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -35,6 +35,13 @@  GLOBAL_ONLY_SETTINGS = (
     "top-dir-name",
 )
 
+def color_enabled() -> bool:
+    """
+    Our logger has a BBLogFormatter formatter which holds whether color is
+    enabled or not. Return this value.
+    """
+    return logger.handlers[0].formatter.color_enabled
+
 # If bitbake is from a release tarball or somewhere like pypi where
 # updates may not be straightforward, prefer to use the git repo as the
 # default registry