Fix run_targets running scripts from different subdirs.

0.57
Jussi Pakkanen 4 years ago committed by Nirbheek Chauhan
parent c6dd75a1bd
commit 6ffa815c05
  1. 2
      mesonbuild/interpreter.py
  2. 9
      run_unittests.py
  3. 2
      test cases/common/52 run target/meson.build
  4. 3
      test cases/common/52 run target/subdir/textprinter.py

@ -4079,6 +4079,8 @@ This will become a hard error in the future.''' % kwargs['input'], location=self
if isinstance(i, dependencies.ExternalProgram) and not i.found(): if isinstance(i, dependencies.ExternalProgram) and not i.found():
raise InterpreterException('Tried to use non-existing executable {!r}'.format(i.name)) raise InterpreterException('Tried to use non-existing executable {!r}'.format(i.name))
cleaned_args.append(i) cleaned_args.append(i)
if isinstance(cleaned_args[0], str):
cleaned_args[0] = self.func_find_program(node, cleaned_args[0], {})
name = args[0] name = args[0]
if not isinstance(name, str): if not isinstance(name, str):
raise InterpreterException('First argument must be a string.') raise InterpreterException('First argument must be a string.')

@ -2384,6 +2384,15 @@ class AllPlatformTests(BasePlatformTests):
self.run_target('check-env') self.run_target('check-env')
self.run_target('check-env-ct') self.run_target('check-env-ct')
def test_run_target_subdir(self):
'''
Test that run_targets are run from the correct directory
https://github.com/mesonbuild/meson/issues/957
'''
testdir = os.path.join(self.common_test_dir, '52 run target')
self.init(testdir)
self.run_target('textprinter')
def test_install_introspection(self): def test_install_introspection(self):
''' '''
Tests that the Meson introspection API exposes install filenames correctly Tests that the Meson introspection API exposes install filenames correctly

@ -103,3 +103,5 @@ custom_target('check-env-ct',
'MY_ENV': '1'}, 'MY_ENV': '1'},
output: 'check-env-ct', output: 'check-env-ct',
) )
run_target('textprinter', command: ['subdir/textprinter.py'])

@ -0,0 +1,3 @@
#!/usr/bin/env python3
print('I am a script. Being run.')
Loading…
Cancel
Save