summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2021-12-14 23:10:01 (GMT)
committerEli Schwartz <eschwartz@archlinux.org>2021-12-14 23:21:09 (GMT)
commite7e5dd883a8dc379bc425ec2f4df3128f1ae15f4 (patch)
treef61ae54103453d545c623636b383cd41d6ba58ef
parent4c9431e9af596af0556e5da0ae99305bafb2b10b (diff)
downloadlz4-e7e5dd883a8dc379bc425ec2f4df3128f1ae15f4.zip
lz4-e7e5dd883a8dc379bc425ec2f4df3128f1ae15f4.tar.gz
lz4-e7e5dd883a8dc379bc425ec2f4df3128f1ae15f4.tar.bz2
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.
-rw-r--r--contrib/meson/meson/meson.build9
1 files 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