aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/build.py2
-rw-r--r--mesonbuild/interpreter.py6
-rw-r--r--test cases/common/105 find program path/meson.build11
-rw-r--r--test cases/common/105 find program path/program.py3
4 files changed, 21 insertions, 1 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index c0ba895..f9e628d 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -808,6 +808,8 @@ class CustomTarget:
if not isinstance(s, str):
raise InvalidArguments('Array as argument %d contains a non-string.' % i)
final_cmd.append(s)
+ elif isinstance(c, File):
+ final_cmd.append(os.path.join(c.subdir, c.fname))
else:
raise InvalidArguments('Argument %s in "command" is invalid.' % i)
self.command = final_cmd
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index a633917..4d41f1a 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -242,11 +242,15 @@ class ExternalProgramHolder(InterpreterObject):
def __init__(self, ep):
InterpreterObject.__init__(self)
self.held_object = ep
- self.methods.update({'found': self.found_method})
+ self.methods.update({'found': self.found_method,
+ 'path': self.path_method})
def found_method(self, args, kwargs):
return self.found()
+ def path_method(self, args, kwargs):
+ return self.get_command()
+
def found(self):
return self.held_object.found()
diff --git a/test cases/common/105 find program path/meson.build b/test cases/common/105 find program path/meson.build
new file mode 100644
index 0000000..b21d659
--- /dev/null
+++ b/test cases/common/105 find program path/meson.build
@@ -0,0 +1,11 @@
+project('find program', 'c')
+
+prog = find_program('program.py')
+
+# Use either Python3 or 2 to run this
+python = find_program('python3', required : false)
+if not python.found()
+ python = find_program('python')
+endif
+
+run_command(python, prog.path())
diff --git a/test cases/common/105 find program path/program.py b/test cases/common/105 find program path/program.py
new file mode 100644
index 0000000..2ebc564
--- /dev/null
+++ b/test cases/common/105 find program path/program.py
@@ -0,0 +1,3 @@
+#!/usr/bin/env python3
+
+print("Found")