From e7e5dd883a8dc379bc425ec2f4df3128f1ae15f4 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Tue, 14 Dec 2021 18:10:01 -0500 Subject: meson: simplify version lookup and avoid deprecation warnings run_command() in development versions of meson will warn when the `check: ` kwarg is not specified. At the same time, lz4 has some gnarly code to manually check the return code and raise an error if it failed. Kill two birds with one stone, by making run_command inherently raise a fatal error when erroring out, then proceeding in the knowledge that it must have succeeded. --- contrib/meson/meson/meson.build | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/contrib/meson/meson/meson.build b/contrib/meson/meson/meson.build index b278b7c..2cfd48c 100644 --- a/contrib/meson/meson/meson.build +++ b/contrib/meson/meson/meson.build @@ -28,13 +28,8 @@ lz4_version = meson.project_version() lz4_h_file = join_paths(meson.current_source_dir(), '../../../lib/lz4.h') GetLz4LibraryVersion_py = find_program('GetLz4LibraryVersion.py', native : true) -r = run_command(GetLz4LibraryVersion_py, lz4_h_file) -if r.returncode() == 0 - lz4_version = r.stdout().strip() - message('Project version is now: @0@'.format(lz4_version)) -else - error('Cannot find project version in @0@'.format(lz4_h_file)) -endif +lz4_version = run_command(GetLz4LibraryVersion_py, lz4_h_file, check: true).stdout().strip() +message('Project version is now: @0@'.format(lz4_version)) lz4_libversion = lz4_version -- cgit v0.12