From fd78c5a128460c88631b50b3c22a48d7675c9bc1 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Fri, 4 Sep 2015 21:57:34 +0300 Subject: [PATCH] Drop non-numeric suffix in version numbers. Closes #258. --- mesonlib.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mesonlib.py b/mesonlib.py index 76fb792fa..d199725f1 100644 --- a/mesonlib.py +++ b/mesonlib.py @@ -113,9 +113,13 @@ def detect_vcs(source_dir): return vcs return None +numpart = re.compile('[0-9.]+') + def version_compare(vstr1, vstr2): - if '-' in vstr1: - vstr1 = vstr1.split('-')[0] + match = numpart.match(vstr1.strip()) + if match is None: + raise MesonException('Unconparable version string %s.' % vstr1) + vstr1 = match.group(0) if vstr2.startswith('>='): cmpop = operator.ge vstr2 = vstr2[2:]