summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--waftools/detections/compiler_swift.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py
index cf55149291..3c130302be 100644
--- a/waftools/detections/compiler_swift.py
+++ b/waftools/detections/compiler_swift.py
@@ -1,3 +1,4 @@
+import re
from waflib import Utils
def __run(cmd):
@@ -11,7 +12,9 @@ def __add_swift_flags(ctx):
ctx.env.SWIFT_FLAGS = ('-frontend -c -sdk %s -enable-objc-interop'
' -emit-objc-header -parse-as-library'
' -target x86_64-apple-macosx10.10') % (ctx.env.MACOS_SDK)
- ctx.env.SWIFT_VERSION = __run([ctx.env.SWIFT, '-version']).split(' ')[3]
+
+ ver = re.compile("(?i)version\s?([\d.]+)")
+ ctx.env.SWIFT_VERSION = ver.search(__run([ctx.env.SWIFT, '-version'])).group(1)
major, minor = [int(n) for n in ctx.env.SWIFT_VERSION.split('.')[:2]]
# the -swift-version parameter is only supported on swift 3.1 and newer