@@ -29,6 +29,8 @@ import bb.process
logger = bb.msg.logger_create('bitbake-setup', sys.stdout)
+BBSETUP_COLOR = False
+
# These settings can only be set in the global context
GLOBAL_ONLY_SETTINGS = (
"top-dir-prefix",
@@ -1095,6 +1097,10 @@ def main():
elif args.quiet:
logger.setLevel(logging.ERROR)
+ global BBSETUP_COLOR
+ if args.color == 'always' or (args.color == 'auto' and sys.stdout.isatty() and os.environ.get('NO_COLOR', '') == ''):
+ BBSETUP_COLOR = True
+
# Need to re-run logger_create with color argument
# (will be the same logger since it has the same name)
bb.msg.logger_create('bitbake-setup', output=sys.stdout,
Define a BBSETUP_COLOR global variable that holds the color choice optionally passed from the command-line. 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 | 6 ++++++ 1 file changed, 6 insertions(+)