aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreter.py8
-rwxr-xr-xrun_unittests.py5
-rw-r--r--test cases/unit/12 cross prog/meson.build4
3 files changed, 13 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 79fc9fb..8f6f79d 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2627,8 +2627,12 @@ external dependencies (including libraries) must go to "dependencies".''')
if not isinstance(p, str):
raise InterpreterException('Executable name must be a string.')
if p in bins:
- exename = bins[p]
- extprog = dependencies.ExternalProgram(exename, silent=silent)
+ command = bins[p]
+ if isinstance(command, (list, str)):
+ extprog = dependencies.ExternalProgram(p, command=command, silent=silent)
+ else:
+ raise InterpreterException('Invalid type {!r} for binary {!r} in cross file'
+ ''.format(command, p))
progobj = ExternalProgramHolder(extprog)
return progobj
diff --git a/run_unittests.py b/run_unittests.py
index 0abe419..8b664a3 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3207,7 +3207,8 @@ class LinuxlikeTests(BasePlatformTests):
c = '/usr/bin/cc'
ar = '/usr/bin/ar'
strip = '/usr/bin/ar'
-sometool.py = '%s'
+sometool.py = ['{0}']
+someothertool.py = '{0}'
[properties]
@@ -3216,7 +3217,7 @@ system = 'linux'
cpu_family = 'arm'
cpu = 'armv7' # Not sure if correct.
endian = 'little'
-''' % os.path.join(testdir, 'some_cross_tool.py'))
+'''.format(os.path.join(testdir, 'some_cross_tool.py')))
crossfile.flush()
self.meson_cross_file = crossfile.name
self.init(testdir)
diff --git a/test cases/unit/12 cross prog/meson.build b/test cases/unit/12 cross prog/meson.build
index e628701..a7adeb2 100644
--- a/test cases/unit/12 cross prog/meson.build
+++ b/test cases/unit/12 cross prog/meson.build
@@ -2,11 +2,15 @@ project('cross find program', 'c')
native_exe = find_program('sometool.py', native : true)
cross_exe = find_program('sometool.py')
+cross_other_exe = find_program('someothertool.py')
native_out = run_command(native_exe).stdout().strip()
cross_out = run_command(cross_exe).stdout().strip()
+cross_other_out = run_command(cross_other_exe).stdout().strip()
assert(native_out == 'native',
'Native output incorrect:' + native_out)
assert(cross_out == 'cross',
'Cross output incorrect:' + cross_out)
+assert(cross_out == cross_other_out,
+ 'Cross output incorrect:' + cross_other_out)