public inbox for bitbake-devel@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Antonin Godard" <antonin.godard@bootlin.com>
To: "Alexander Kanavin" <alex.kanavin@gmail.com>
Cc: <bitbake-devel@lists.openembedded.org>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [bitbake-devel] [PATCH v2 3/4] bitbake-setup: print colored diffs
Date: Thu, 19 Feb 2026 11:18:53 +0100	[thread overview]
Message-ID: <DGIV1GKTYP9C.1OMEZARTNTX1U@bootlin.com> (raw)
In-Reply-To: <CANNYZj9grDk3dYjGARxhyca6a++GtHYaSKB0ouxpaoX03NWt+Q@mail.gmail.com>

Hi,

On Thu Feb 19, 2026 at 10:36 AM CET, Alexander Kanavin wrote:
> On Wed, 18 Feb 2026 at 16:27, Antonin Godard via
> lists.openembedded.org
> <antonin.godard=bootlin.com@lists.openembedded.org> wrote:
>
>> Oops, this slipped through, but shouldn't be changed at all since it is removed
>> in the next commit. I will resend the series.
>
> Also the function is *way* over-engineered. I only wanted to avoid
> repeating the color logic, so perhaps just this bit could be
> abstracted and used in all three locations?
>
> def get_color_param():
>     return "always" if BBSETUP_COLOR else "never"

Not sure I follow.

def color_enabled() -> bool:
    return logger.handlers[0].formatter.color_enabled

IMO this is better than the previous version which did:

global BBSETUP_COLOR
if args.color == 'always' or (args.color == 'auto' and sys.stdout.isatty() and os.environ.get('NO_COLOR', '') == ''):
    BBSETUP_COLOR = True

That logic is already present in the logger object, in msg.py, when creating the
logger:

if color == 'always' or (color == 'auto' and output.isatty() and os.environ.get('NO_COLOR', '') == ''):
    format.enable_color()

The proposal here was to get rid of BBSETUP_COLOR entirely and avoid
duplication. Not sure how this is *way* over-engineered, I'd rather see it as a
simplification

Antonin


  reply	other threads:[~2026-02-19 10:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18 13:15 [PATCH v2 0/4] bitbake-setup: Improve readability Antonin Godard
2026-02-18 13:15 ` [PATCH v2 1/4] bitbake-setup: define a color_enabled() helper function Antonin Godard
2026-02-18 13:15 ` [PATCH v2 2/4] bitbake-setup: improve readability of choices Antonin Godard
2026-02-18 13:15 ` [PATCH v2 3/4] bitbake-setup: print colored diffs Antonin Godard
2026-02-18 15:27   ` Antonin Godard
2026-02-19  9:36     ` [bitbake-devel] " Alexander Kanavin
2026-02-19 10:18       ` Antonin Godard [this message]
2026-02-19 11:13         ` Alexander Kanavin
2026-02-20  9:14           ` Antonin Godard
2026-02-18 13:15 ` [PATCH v2 4/4] bitbake-setup: drop get_diff and replace by run_git_diff Antonin Godard

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=DGIV1GKTYP9C.1OMEZARTNTX1U@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=alex.kanavin@gmail.com \
    --cc=bitbake-devel@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox