diff options
author | Akemi <der.richter@gmx.de> | 2018-11-24 12:49:55 +0100 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2019-04-02 01:43:54 +0300 |
commit | a3e6b81305ea1e7bf78aec6a83b64fd6071a9440 (patch) | |
tree | 2f4ea46588b75b9ba0a0148bc67d1848c1aef46f /waftools/detections | |
parent | de2b1920f33f8c81c1de2b1babcc76e8bce4576a (diff) | |
download | mpv-a3e6b81305ea1e7bf78aec6a83b64fd6071a9440.tar.bz2 mpv-a3e6b81305ea1e7bf78aec6a83b64fd6071a9440.tar.xz |
build: use StrictVersion for swift version comparison
Diffstat (limited to 'waftools/detections')
-rw-r--r-- | waftools/detections/compiler_swift.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/waftools/detections/compiler_swift.py b/waftools/detections/compiler_swift.py index f88bf83a65..59f1385ba9 100644 --- a/waftools/detections/compiler_swift.py +++ b/waftools/detections/compiler_swift.py @@ -1,5 +1,6 @@ import re from waflib import Utils +from distutils.version import StrictVersion def __run(cmd): try: @@ -15,12 +16,11 @@ def __add_swift_flags(ctx): "-target", "x86_64-apple-macosx10.10" ] - 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]] + verRe = re.compile("(?i)version\s?([\d.]+)") + ctx.env.SWIFT_VERSION = verRe.search(__run([ctx.env.SWIFT, '-version'])).group(1) # the -swift-version parameter is only supported on swift 3.1 and newer - if major >= 3 and minor >= 1 or major >= 4: + if StrictVersion(ctx.env.SWIFT_VERSION) >= StrictVersion("3.1"): ctx.env.SWIFT_FLAGS.extend([ "-swift-version", "3" ]) if ctx.is_debug_build(): |