| 1 |
project('find program') |
| 2 |
|
| 3 |
python = import('python3').find_python() |
| 4 |
|
| 5 |
# Source file via string |
| 6 |
prog = find_program('program.py') |
| 7 |
# Source file via files() |
| 8 |
progf = files('program.py') |
| 9 |
# Built file |
| 10 |
py = configure_file(input : 'program.py', |
| 11 |
output : 'builtprogram.py', |
| 12 |
configuration : configuration_data()) |
| 13 |
|
| 14 |
foreach f : [prog, progf, py, find_program(py), find_program(progf)] |
| 15 |
ret = run_command(python, f, check: false) |
| 16 |
assert(ret.returncode() == 0, 'can\'t manually run @0@'.format(prog.path())) |
| 17 |
assert(ret.stdout().strip() == 'Found', 'wrong output from manually-run @0@'.format(prog.path())) |
| 18 |
|
| 19 |
ret = run_command(f, check: false) |
| 20 |
assert(ret.returncode() == 0, 'can\'t run @0@'.format(prog.path())) |
| 21 |
assert(ret.stdout().strip() == 'Found', 'wrong output from @0@'.format(prog.path())) |
| 22 |
endforeach |