summaryrefslogtreecommitdiffstats
path: root/waftools/detections/compiler_swift.py
diff options
context:
space:
mode:
authorAkemi <der.richter@gmx.de>2018-10-15 19:59:11 +0200
committerJan Ekström <jeebjp@gmail.com>2018-10-22 01:41:09 +0300
commit6fbd933108a74bbd3a375be1456692320a97380e (patch)
tree06ebe50798b479e0afb97fa73d294f9bb017f44b /waftools/detections/compiler_swift.py
parentfacc63b862069eb24c14837a6762e5e681e52b7a (diff)
downloadmpv-6fbd933108a74bbd3a375be1456692320a97380e.tar.bz2
mpv-6fbd933108a74bbd3a375be1456692320a97380e.tar.xz
build: more reliable way of getting the Swift version from a string
Fixes #6212
Diffstat (limited to 'waftools/detections/compiler_swift.py')
-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