summaryrefslogtreecommitdiff
path: root/scripts/Util.py
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2019-08-02 10:03:38 +0200
committerJose <jose@zeroc.com>2019-08-02 10:03:38 +0200
commit052825076a0ac28392a825d73e96e6f9dbadc23b (patch)
treed4896d9a09747364854aa5fd3b3e7adaf758e087 /scripts/Util.py
parentRun carthage update before generating Xcode projects (diff)
downloadice-052825076a0ac28392a825d73e96e6f9dbadc23b.tar.bz2
ice-052825076a0ac28392a825d73e96e6f9dbadc23b.tar.xz
ice-052825076a0ac28392a825d73e96e6f9dbadc23b.zip
Conditionally enable Swift mapping
Diffstat (limited to 'scripts/Util.py')
-rw-r--r--scripts/Util.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/Util.py b/scripts/Util.py
index 723ee07bbb9..594fb58e742 100644
--- a/scripts/Util.py
+++ b/scripts/Util.py
@@ -220,6 +220,7 @@ class Platform(object):
self.nugetPackageCache = None
self._hasNodeJS = None
+ self._hasSwift = None
def init(self, component):
self.parseBuildVariables(component, {
@@ -239,6 +240,18 @@ class Platform(object):
self._hasNodeJS = False
return self._hasNodeJS
+ def hasSwift(self, version):
+ if self._hasSwift is None:
+ try:
+ m = re.search("Apple Swift version ([0-9]+\.[0-9]+\.[0-9]+)", run("swift --version"))
+ if m and m.group(1):
+ self._hasSwift = tuple([int(n) for n in m.group(1).split(".")]) >= version
+ else:
+ self.hasSwift = False
+ except:
+ self._hasSwift = False
+ return self._hasSwift
+
def parseBuildVariables(self, component, variables):
# Run make to get the values of the given variables
if os.path.exists(os.path.join(component.getSourceDir(), "Makefile")): # Top level makefile