aboutsummaryrefslogtreecommitdiff
path: root/mesonlib.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2015-09-17 20:07:40 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2015-09-17 20:07:40 +0300
commit5c5f8c781385d416748000dbdb6f74fa59382340 (patch)
tree7e2840d1befa52d6e5e95add4e68013ba7b12f46 /mesonlib.py
parent067935ce76c03099abe83998c7c0cb80f64b92f1 (diff)
parent77d53c2266ec0d8cb4d2a0da9fae93f0eafb30c7 (diff)
downloadmeson-5c5f8c781385d416748000dbdb6f74fa59382340.zip
meson-5c5f8c781385d416748000dbdb6f74fa59382340.tar.gz
meson-5c5f8c781385d416748000dbdb6f74fa59382340.tar.bz2
Merged trunk changes.
Diffstat (limited to 'mesonlib.py')
-rw-r--r--mesonlib.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonlib.py b/mesonlib.py
index 76fb792..d7c40f4 100644
--- a/mesonlib.py
+++ b/mesonlib.py
@@ -14,7 +14,7 @@
"""A library of random helper functionality."""
-import platform, subprocess, operator, os, shutil, re
+import platform, subprocess, operator, os, shutil, re, sys
from glob import glob
@@ -79,6 +79,9 @@ def is_windows():
platname = platform.system().lower()
return platname == 'windows' or 'mingw' in platname
+def is_32bit():
+ return not(sys.maxsize > 2**32)
+
def is_debianlike():
try:
open('/etc/debian_version', 'r')
@@ -113,9 +116,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:]