diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-03-09 15:28:18 -0500 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2023-03-28 09:12:02 -0400 |
commit | a7930a2cd7a4f72f964541a4b65a988215def7b9 (patch) | |
tree | 61227a11cd2f3b4c70d72f1aaad4a9c1303eb799 | |
parent | 3070bd49a28ae62a4d1ee9828cd658d9782fb17e (diff) | |
download | meson-a7930a2cd7a4f72f964541a4b65a988215def7b9.zip meson-a7930a2cd7a4f72f964541a4b65a988215def7b9.tar.gz meson-a7930a2cd7a4f72f964541a4b65a988215def7b9.tar.bz2 |
backends: fix bug where meson_exe crashed if constructed with found programs
Because we base the pickled data name on the name property of the
command being run... and for built targets, `exe.name` is always just
the name. However, for an ExternalProgram this is just whatever string
we searched for, so, NOT just the basename.
This became a bigger issue once we started using generator() with the
actual program in commit 6aeec808367f05463394e30a8d40834e97c7afc0,
rather than first casting it to a string, because the VS backend
*always* uses the meson_exe approach for various reasons related to VS
being VS.
Outside of that, it's difficult to actually get an ExternalProgram
object passed to meson_exe -- CustomTarget lowers it to a string,
capture is handled via argparse instead of pickling, etc.
Fixes #11593
-rw-r--r-- | mesonbuild/backend/backends.py | 2 | ||||
-rw-r--r-- | test cases/common/195 generator in subdir/com/mesonbuild/meson.build | 2 | ||||
-rw-r--r-- | test cases/common/195 generator in subdir/com/mesonbuild/tooldir/genprog.py (renamed from test cases/common/195 generator in subdir/com/mesonbuild/genprog.py) | 0 |
3 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 6370800..408cd0a 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -633,7 +633,7 @@ class Backend: if isinstance(exe, (programs.ExternalProgram, build.BuildTarget, build.CustomTarget)): - basename = exe.name + basename = os.path.basename(exe.name) elif isinstance(exe, mesonlib.File): basename = os.path.basename(exe.fname) else: diff --git a/test cases/common/195 generator in subdir/com/mesonbuild/meson.build b/test cases/common/195 generator in subdir/com/mesonbuild/meson.build index 4808743..6469a2e 100644 --- a/test cases/common/195 generator in subdir/com/mesonbuild/meson.build +++ b/test cases/common/195 generator in subdir/com/mesonbuild/meson.build @@ -1,4 +1,4 @@ -gprog = find_program('genprog.py') +gprog = find_program('tooldir/genprog.py') gen = generator(gprog, \ output : ['@BASENAME@.c', '@BASENAME@.h'], diff --git a/test cases/common/195 generator in subdir/com/mesonbuild/genprog.py b/test cases/common/195 generator in subdir/com/mesonbuild/tooldir/genprog.py index 681c43a..681c43a 100644 --- a/test cases/common/195 generator in subdir/com/mesonbuild/genprog.py +++ b/test cases/common/195 generator in subdir/com/mesonbuild/tooldir/genprog.py |