From eb260f614195306d91e525f703eaa5708c0b1e88 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 13 Aug 2018 20:09:25 +0100 Subject: [PATCH] Allow features added in 0.nn.0 to be used when version constraint is '>=0.nn' --- mesonbuild/mesonlib.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py index b117cf56f..05a77cda5 100644 --- a/mesonbuild/mesonlib.py +++ b/mesonbuild/mesonlib.py @@ -509,6 +509,20 @@ def version_compare_condition_with_min(condition, minimum): return True else: cmpop = operator.le + + # Declaring a project(meson_version: '>=0.46') and then using features in + # 0.46.0 is valid, because (knowing the meson versioning scheme) '0.46.0' is + # the lowest version which satisfies the constraint '>=0.46'. + # + # But this will fail here, because the minimum version required by the + # version constraint ('0.46') is strictly less (in our version comparison) + # than the minimum version needed for the feature ('0.46.0'). + # + # Map versions in the constraint of the form '0.46' to '0.46.0', to embed + # this knowledge of the meson versioning scheme. + if re.match('^\d+.\d+$', condition): + condition += '.0' + return cmpop(Version(minimum), Version(condition)) def default_libdir():