From 1d2f4ef5a8b05698e33ce8dd87d01c091d38c7b2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 23 Sep 2023 17:54:45 -0400 Subject: Avoid use of deprecated meson string formatting with files Meson annoyingly doesn't provide access to the path of file objects (but it should). It was possible to do that by formatting a string with a file argument, but now this triggers a loud warning that claims it has always been broken and will be deprecated. So, avoid this by juggling things around and maintaining unchecked path strings instead, and hope that they're all passed to files() at some point so they can't get stale. --- meson.build | 14 -------------- test/meson.build | 39 +++++++++++++++++++++++++++++---------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/meson.build b/meson.build index f50c8f52..be430a13 100644 --- a/meson.build +++ b/meson.build @@ -222,20 +222,6 @@ endif # Support # ########### -ttl_metadata_files = files( - 'test/extra/abbreviate/manifest.ttl', - 'test/extra/bad/manifest.ttl', - 'test/extra/big/manifest.ttl', - 'test/extra/good/manifest.ttl', - 'test/extra/lax/manifest.ttl', - 'test/extra/perfect/manifest.ttl', - 'test/extra/prefix/manifest.ttl', - 'test/extra/pretty/manifest.ttl', - 'test/extra/qualify/manifest.ttl', - 'test/extra/root/manifest.ttl', - 'serd.ttl', -) - subdir('scripts') if not get_option('tests').disabled() diff --git a/test/meson.build b/test/meson.build index 9662f9f3..f6f56c2b 100644 --- a/test/meson.build +++ b/test/meson.build @@ -8,20 +8,38 @@ wrapper = meson.get_external_property('exe_wrapper', '') # Scripts and Metadata # ######################## -plot_scripts = files( +plot_script_paths = [ '../scripts/serd_bench.py', -) +] -simple_scripts = files( +simple_script_paths = [ '../scripts/check_formatting.py', 'serd_test_util/__init__.py', 'run_suite.py', 'test_quiet.py', 'test_stdin.py', 'test_write_error.py', -) +] + +ttl_metadata_file_paths = [ + '../serd.ttl', + 'extra/abbreviate/manifest.ttl', + 'extra/bad/manifest.ttl', + 'extra/big/manifest.ttl', + 'extra/full/manifest.ttl', + 'extra/good/manifest.ttl', + 'extra/lax/manifest.ttl', + 'extra/perfect/manifest.ttl', + 'extra/prefix/manifest.ttl', + 'extra/pretty/manifest.ttl', + 'extra/qualify/manifest.ttl', + 'extra/root/manifest.ttl', +] -python_scripts = simple_scripts + plot_scripts +plot_scripts = files(plot_script_paths) +simple_scripts = files(simple_script_paths) +python_script_paths = simple_script_paths + plot_script_paths +python_scripts = plot_scripts + simple_scripts if get_option('lint') # Check release metadata @@ -47,8 +65,9 @@ if get_option('lint') black = find_program('black', required: false) if black.found() black_opts = ['--check', '-q', '-l', '79'] - foreach script : python_scripts - name = '@0@'.format(script).underscorify() + foreach script_path : python_script_paths + script = files(script_path) + name = script_path.underscorify() test(name, black, args: black_opts + [script], suite: 'scripts') endforeach endif @@ -79,11 +98,11 @@ if get_option('lint') endif # Check Turtle formatting with serdi - foreach ttl_file : ttl_metadata_files + foreach ttl_file_path : ttl_metadata_file_paths test( - '@0@'.format(ttl_file).underscorify(), + ttl_file_path.underscorify(), check_formatting_py, - args: [ttl_file, serdi, '-o', 'turtle'], + args: [files(ttl_file_path), serdi, '-o', 'turtle'], suite: 'data', ) endforeach -- cgit v1.2.1