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 <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20752>
This commit is contained in:
Dylan Baker 2023-01-17 09:50:26 -08:00 committed by Marge Bot
parent c31629ee78
commit a79e6457d8
2 changed files with 1 additions and 43 deletions

View File

@ -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()

View File

@ -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']