Open jon-turney opened 5 years ago
This test case seems a little odd. find_program('foo')
will (sometimes) find foo.py
on windows, but not on any other platform?
Yes, that's how Windows PATH
searching works. There's no executable bit, so executables are identified by their extension. The default value for PATHEXT
is .COM;.EXE;.BAT;.CMD
and if you want python scripts to be identified as executables, you have to append ;.PY
to that (the Python installer does this for you).
Of course this is optional, and the reason why the test contains this is just to ensure that this edge-case works (I'm sure some windows-only meson projects will want to assume that find_program('foo')
can find foo.py
in the correct configuration).
Nothing in Meson depends on it, since we expect people to look for scripts with find_program('foo.py')
since that is the cross-platform way of doing it. We can just skip that line of the test if .PY
is not in PATHEXT
, but we should ensure that at least one of our CI jobs has .PY
in PATHEXT
.
Also, Meson supports looking for scripts with a #!.* python
named foo
with find_program('foo')
through manual listing of directories specified in PATH
because a lot of Linux-origin projects tend to install scripts without extensions on all platforms (f.ex., glib).
As it seems, this issue reappeared. Looking at the build pipeline, This commit did, in fact, address the issue, but then, a few commit later, the same error messages reappeared on the master branch without an accidental revert or a similar obvious reason.
Reopening as per https://github.com/mesonbuild/meson/pull/5564#issuecomment-506522689.
Still reproducible in meson 1.4. meson can't find yelp-build(.py) provided by yelp-tools MSYS2 package.
I apologise again for the terrible title I chose initially for this issue.
It seems like find_program() should never use PATHEXT on Windows, as that leads to find_program("something") working, when a well formed meson.build should say find_program("something.py"), but making that change would break existing meson.build which happen to work in some places...
Should people have to specify find_program('foo.exe')
on Windows and find_program('foo')
on Linux?
Still reproducible in meson 1.4. meson can't find yelp-build(.py) provided by yelp-tools MSYS2 package.
The msys2 package list at packages.msys2.org lists that it provides a file called usr/bin/yelp-build with no extension, not even a .py extension. Is this correct?
@eli-schwartz Yes. There is no .py extension.
In that case I'm not sure I understand the problem. At least this isn't related to PATHEXT.
Should people have to specify
find_program('foo.exe') on Windows and
find_program('foo')` on Linux?
You're quite right. Perhaps I mean "find_program() shouldn't use an unspecified, non-default value of PATHEXT inherited from the environment"?
test_find_program()
(a windows-only test) fails if.py
isn't inPATHEXT