summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-11-14 08:55:30 (GMT)
committerSwift Review <review@swift.im>2012-11-14 09:54:12 (GMT)
commitc733ee6f86513adf59ead706fc82711c3ca1e1ec (patch)
tree64c7a6a4dbd61123d784bc55d3b3e5f3b9a36fa5 /BuildTools/SCons/Version.py
parent10c43c39dfd926e7a70ce8a68e33859acf681404 (diff)
downloadswift-contrib-c733ee6f86513adf59ead706fc82711c3ca1e1ec.zip
swift-contrib-c733ee6f86513adf59ead706fc82711c3ca1e1ec.tar.bz2
Use version numbers for Swift binary so upgrades work
Change-Id: If491b0a62782d568cad132c8c5856aaeb3a3967a
Diffstat (limited to 'BuildTools/SCons/Version.py')
-rw-r--r--BuildTools/SCons/Version.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index 57ef96d..a912e02 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -30,3 +30,33 @@ def getBuildVersion(root, project) :
return gitVersion
return datetime.date.today().strftime("%Y%m%d")
+
+def convertToWindowsVersion(version) :
+ version_match = re.match("(\d+)\.(\d+)(.*)", version)
+ major = int(version_match.group(1)) if version_match else 0
+ minor = int(version_match.group(2)) if version_match else 0
+ if version_match and len(version_match.group(3)) == 0 :
+ patch = 99999
+ else :
+ match = re.match("^beta(\d+)(.*)", version_match.group(3))
+ build_string = ""
+ if match :
+ patch = 1000*int(match.group(1))
+ build_string = match.group(2)
+ else :
+ match = re.match("^rc(\d+)(.*)", version_match.group(3))
+ if match :
+ patch = 10000*int(rc_match.group(1))
+ build_string = match.group(2)
+ else :
+ match = re.match("^alpha(.*)", version_match.group(3))
+ if match :
+ build_string = match.group(1)
+
+ if len(build_string) > 0 :
+ build_match = re.match("^-dev(\d+)", build_string)
+ if build_match :
+ patch += int(build_match.group(1))
+
+ return (major, minor, patch)
+