meson: use files() not find_program() for helper scripts

We went back and forth between 'prog.sh', files('prog.sh'), and
find_program('prog.sh'). We want to use files() or find_program() so that we
get a good error message if the file is missing. Behaviour of meson changed
over time, and in the past not all forms could be used in all places. For
example 0f4c4f3824 added find_program() in many
places to avoid repeated messages. But it seems that all recent meson versions
work fine with files().

find_program prints silly messages:
  Program tools/make-man-index.py found: YES
       (/home/zbyszek/src/systemd/tools/make-man-index.py)
  Program tools/meson-render-jinja2.py found: YES
       (/home/zbyszek/src/systemd/tools/meson-render-jinja2.py)
  ...
We know that those files will be found, they are part of the git checkout.
With files() this is gone and the meson output is easier to read.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-07-25 14:04:17 +02:00
parent 8aedfd979f
commit c5dcbd073e
12 changed files with 71 additions and 70 deletions
+5 -6
View File
@@ -168,11 +168,12 @@ basic_sources += generated_gperf_headers
############################################################
check_filesystems = find_program('check-filesystems.sh')
r = run_command(
[
'env', '--chdir', meson.project_build_root(),
check_filesystems, cpp, files('filesystems-gperf.gperf'),
files('check-filesystems.sh'),
cpp,
files('filesystems-gperf.gperf'),
system_include_args,
],
check: false,
@@ -186,19 +187,17 @@ filesystems_gperf_h = custom_target(
output : 'filesystems-gperf.h',
command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
generate_filesystem_list = find_program('generate-filesystem-list.py')
filesystem_list_inc = custom_target(
input : 'filesystems-gperf.gperf',
output : 'filesystem-list.inc',
command : [generate_filesystem_list,
command : [files('generate-filesystem-list.py'),
'@INPUT@'],
capture : true)
generate_filesystem_switch_case_inc = find_program('generate-filesystem-switch-case.py')
filesystem_switch_case_inc = custom_target(
input : 'filesystems-gperf.gperf',
output : 'filesystem-switch-case.inc',
command : [generate_filesystem_switch_case_inc,
command : [files('generate-filesystem-switch-case.py'),
'@INPUT@'],
capture : true)