aboutsummaryrefslogtreecommitdiff
path: root/mesonlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonlib.py')
-rw-r--r--mesonlib.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/mesonlib.py b/mesonlib.py
index 76fb792..d199725 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:]