From a79e6457d8aa6eb10b0c3dd0359f25d2e9a839eb Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 17 Jan 2023 09:50:26 -0800 Subject: [PATCH] meson: use builtin support for reading version from a file In meson 0.57 support was added for reading a version from a file to meson natively, so we don't need this workaround anymore. Reviewed-by: Eric Engestrom Part-of: --- bin/meson_get_version.py | 39 --------------------------------------- meson.build | 5 +---- 2 files changed, 1 insertion(+), 43 deletions(-) delete mode 100644 bin/meson_get_version.py diff --git a/bin/meson_get_version.py b/bin/meson_get_version.py deleted file mode 100644 index 91a7e7030d1..00000000000 --- a/bin/meson_get_version.py +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env python3 -# encoding=utf-8 -# Copyright © 2017 Intel Corporation - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: - -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -import argparse -import os - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('version_dir', help="Directory with VERSION file") - args = parser.parse_args() - - filename = os.path.join(args.version_dir, 'VERSION') - with open(filename) as f: - version = f.read().strip() - print(version, end='') - - -if __name__ == '__main__': - main() diff --git a/meson.build b/meson.build index 30ba422e36c..d8c79d42421 100644 --- a/meson.build +++ b/meson.build @@ -21,10 +21,7 @@ project( 'mesa', ['c', 'cpp'], - version : run_command( - [find_program('python3', 'python'), 'bin/meson_get_version.py', meson.project_source_root()], - check : true - ).stdout(), + version : files('VERSION'), license : 'MIT', meson_version : '>= 0.59', default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c11', 'cpp_std=c++17', 'rust_std=2021']