From: "Antonin Godard" <antonin.godard@bootlin.com>
To: <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: Fri, 20 Feb 2026 10:14:48 +0100 [thread overview]
Message-ID: <DGJOAXSZ50FZ.EK06RN4G1XC@bootlin.com> (raw)
In-Reply-To: <CANNYZj8qG7NJHmMOLmUvPXM_=mHahRCtZ6uX1NWM7rdjxxON7A@mail.gmail.com>
On Thu Feb 19, 2026 at 12:13 PM CET, Alexander Kanavin via lists.openembedded.org wrote:
> On Thu, 19 Feb 2026 at 11:18, Antonin Godard <antonin.godard@bootlin.com> wrote:
>> 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
>
> Apologies, I started writing emails before putting enough coffee in my
> bloodstream and got everyone confused.
>
> What I mean is that run_git_diff() ended up being too complex, because
> it aims to cover all possible use cases of getting a diff. I know I
> had asked for that :) but I wonder if instead of that whole new
> function, we could simply add:
>
> def get_color_param():
> return "--color={}".format("always" if color_enabled() else "never")
>
> and then tweak all existing invocations of 'diff' and 'git diff', e.g.:
>
> - bb.process.run('diff -uNr {} {}'.format(file1, file2))
> + bb.process.run('diff {} -uNr {} {}'.format(get_color_param(),
> file1, file2))
>
> Would be a much simpler change, with the same end result.
Gotcha, just sent a new version :)
Antonin
next prev parent reply other threads:[~2026-02-20 9:15 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
2026-02-19 11:13 ` Alexander Kanavin
2026-02-20 9:14 ` Antonin Godard [this message]
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=DGJOAXSZ50FZ.EK06RN4G1XC@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