aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-02-09 23:36:35 -0500
committerNirbheek Chauhan <nirbheek@centricular.com>2023-02-19 03:04:06 +0530
commit96f6cbe66d158d90a02b2b708e64c206b39a0b80 (patch)
tree15322a7dfc505e3f5430f9b430fe93dfd1a32eab
parent8d22b915d30c179b67370198ec7b5146b3370935 (diff)
downloadmeson-96f6cbe66d158d90a02b2b708e64c206b39a0b80.zip
meson-96f6cbe66d158d90a02b2b708e64c206b39a0b80.tar.gz
meson-96f6cbe66d158d90a02b2b708e64c206b39a0b80.tar.bz2
respect the machine file binary overrides, even if it doesn't exist
If someone specifies a binary in a machine file, but the resulting prog.found() is false because it doesn't actually exist on disk, then the user was probably trying to disable finding that program. But find_program() currently doesn't distinguish between a machine file lookup returning a not-found program, and returning a dummy program because there's no entry at all. Explicitly check for a dummy program, rather than checking if the program was found, before deciding whether to discard the lookup results and continue trying other program lookup methods.
-rw-r--r--mesonbuild/interpreter/interpreter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 617b386..a21c809 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -1466,7 +1466,9 @@ class Interpreter(InterpreterBase, HoldableObject):
if not isinstance(p, str):
raise InterpreterException('Executable name must be a string')
prog = ExternalProgram.from_bin_list(self.environment, for_machine, p)
- if prog.found():
+ # if the machine file specified something, it may be a regular
+ # not-found program but we still want to return that
+ if not isinstance(prog, NonExistingExternalProgram):
return prog
return None