Subject: Re: [PATCH 08/11] meson: simplify setup of PATH environment variable

From: Patrick Steinhardt <[email-masked]>
Date: Thu, 30 Jan 2025 08:06:01 +0100

On Wed, Jan 29, 2025 at 02:42:07PM -0600, Justin Tobler wrote:
> On 25/01/29 08:12AM, Patrick Steinhardt wrote:
> >  script_environment = environment()
> > -foreach tool : ['cat', 'grep', 'sed']
> > -  program = find_program(tool, dirs: program_path)
> > -  script_environment.prepend('PATH', fs.parent(program.full_path()))
> > +foreach program : [cat, cygpath, diff, git, grep, sed, shell, tar]
> > +  if program.found()
> > +    script_environment.prepend('PATH', fs.parent(program.full_path()))
> > +  endif
> 
> It looks like cygpath, diff, shell, and tar were previously not being
> appended to the path environment. With this change now they are.

You know, I think I've been approaching this from the wrong angle. It's
not like we need to add these tools to PATH in case they have been found
via the usual PATH lookup: Meson knows to remember PATH just fine, so
the scripts would be able to find them anyway.

The actual issue is that we sometimes end up looking up programs via
something else but PATH, namely on Windows, where we may instead look up
programs via the Git for Windows installation. So the proper way to
handle this is to add these system-specific paths to PATH, not every
single binary's parent directory.

Will adapt, thanks for making me rethink.

Patrick