meson.build 818 B

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