From d8cb62bf2b9bee010a7a4b09138ea15213405a08 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Mon, 12 Jun 2023 20:40:02 -0400 Subject: Allow targetting Meson 1.2.0 when version is 1.1.99 When a project targets a dev version of Meson (e.g. 1.1.99) for experimenting, this allows to use: project(..., meson_version: '>=1.2.0') It avoids getting warnings when using FeatureNew for features introduced in 1.2.0. --- mesonbuild/coredata.py | 10 ++++++++++ mesonbuild/interpreter/interpreter.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index e1fa047..4bd1629 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -61,6 +61,16 @@ if T.TYPE_CHECKING: # But the corresponding Git tag needs to be '0.1.0rc1' version = '1.1.99' +# The next stable version when we are in dev. This is used to allow projects to +# require meson version >=1.2.0 when using 1.1.99. FeatureNew won't warn when +# using a feature introduced in 1.2.0 when using Meson 1.1.99. +stable_version = version +if stable_version.endswith('.99'): + stable_version_array = stable_version.split('.') + stable_version_array[-1] = '0' + stable_version_array[-2] = str(int(version[-2]) + 1) + stable_version = '.'.join(stable_version_array) + backendlist = ['ninja', 'vs', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'vs2017', 'vs2019', 'vs2022', 'xcode', 'none'] DEFAULT_YIELDING = False diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 81a88e5..e97e670 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -526,7 +526,7 @@ class Interpreter(InterpreterBase, HoldableObject): raise InterpreterException(f'Module returned a value of unknown type {v!r}.') def handle_meson_version(self, pv: str, location: mparser.BaseNode) -> None: - if not mesonlib.version_compare(coredata.version, pv): + if not mesonlib.version_compare(coredata.stable_version, pv): raise InterpreterException.from_node(f'Meson version is {coredata.version} but project requires {pv}', node=location) mesonlib.project_meson_versions[self.subproject] = pv -- cgit v1.1