Index: native_client_sdk/src/tools/getos.py |
diff --git a/native_client_sdk/src/tools/getos.py b/native_client_sdk/src/tools/getos.py |
index 62c2b5b7632043f2f4f600404729792acf948036..e9023e2a4cf9fa9592b1235eb40540a187d8bf87 100755 |
--- a/native_client_sdk/src/tools/getos.py |
+++ b/native_client_sdk/src/tools/getos.py |
@@ -191,6 +191,18 @@ def ParseVersion(version): |
raise Error('error parsing SDK version: %s' % version) |
+def CheckVersion(required_version): |
+ version = GetSDKVersion() |
+ # We currently ignore the revision and just check the major version number. |
+ # Currently, version[1] is just a Git hash, which cannot be compared. |
+ # TODO(mgiuca): Compare the minor revision numbers (which should be |
+ # Cr-Commit-Position values), when http://crbug.com/406783 is fixed. |
+ # Then Cr-Commit-Position should be available: see http://crbug.com/406993. |
+ if version[0] < required_version[0]: |
+ raise Error("SDK version too old (current: %s, required: %s)" |
+ % (version[0], required_version[0])) |
+ |
+ |
def main(args): |
parser = optparse.OptionParser() |
parser.add_option('--arch', action='store_true', |
@@ -231,15 +243,7 @@ def main(args): |
out = GetSDKVersion()[1] |
elif options.check_version: |
required_version = ParseVersion(options.check_version) |
- version = GetSDKVersion() |
- # We currently ignore the revision and just check the major version number. |
- # Currently, version[1] is just a Git hash, which cannot be compared. |
- # TODO(mgiuca): Compare the minor revision numbers (which should be |
- # Cr-Commit-Position values), when http://crbug.com/406783 is fixed. |
- # Then Cr-Commit-Position should be available: see http://crbug.com/406993. |
- if version[0] < required_version[0]: |
- raise Error("SDK version too old (current: %s, required: %s)" |
- % (version[0], required_version[0])) |
+ CheckVersion(required_version) |
out = None |
if out: |