aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2018-08-13 20:09:25 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2018-09-12 15:38:00 +0100
commiteb260f614195306d91e525f703eaa5708c0b1e88 (patch)
tree9fe3bd83a57f401c8ae5273c1501723886d39fb1 /mesonbuild/mesonlib.py
parent8d3881a0425a73d9deb22044dd68a895aa749b45 (diff)
downloadmeson-eb260f614195306d91e525f703eaa5708c0b1e88.zip
meson-eb260f614195306d91e525f703eaa5708c0b1e88.tar.gz
meson-eb260f614195306d91e525f703eaa5708c0b1e88.tar.bz2
Allow features added in 0.nn.0 to be used when version constraint is '>=0.nn'
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index b117cf5..05a77cd 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():