OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Determine OS and various other system properties. | 6 """Determine OS and various other system properties. |
7 | 7 |
8 Determine the name of the platform used and other system properties such as | 8 Determine the name of the platform used and other system properties such as |
9 the location of Chrome. This is used, for example, to determine the correct | 9 the location of Chrome. This is used, for example, to determine the correct |
10 Toolchain to invoke. | 10 Toolchain to invoke. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 name, value = line.split(':', 1) | 73 name, value = line.split(':', 1) |
74 if name == "Version": | 74 if name == "Version": |
75 version = value.strip() | 75 version = value.strip() |
76 if name == "Chrome Revision": | 76 if name == "Chrome Revision": |
77 revision = value.strip() | 77 revision = value.strip() |
78 | 78 |
79 if revision == None or version == None: | 79 if revision == None or version == None: |
80 raise Error("error parsing SDK README: %s" % readme) | 80 raise Error("error parsing SDK README: %s" % readme) |
81 | 81 |
82 try: | 82 try: |
83 revision = int(revision) | |
84 version = int(version) | 83 version = int(version) |
85 except ValueError: | 84 except ValueError: |
86 raise Error("error parsing SDK README: %s" % readme) | 85 raise Error("error parsing SDK README: %s" % readme) |
87 | 86 |
88 return (version, revision) | 87 return (version, revision) |
89 | 88 |
90 | 89 |
91 def GetSystemArch(platform): | 90 def GetSystemArch(platform): |
92 if platform == 'win': | 91 if platform == 'win': |
93 if UseWin64(): | 92 if UseWin64(): |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 out = GetNaClArch(platform) | 225 out = GetNaClArch(platform) |
227 elif options.chrome: | 226 elif options.chrome: |
228 out = GetChromePath(platform) | 227 out = GetChromePath(platform) |
229 elif options.sdk_version: | 228 elif options.sdk_version: |
230 out = GetSDKVersion()[0] | 229 out = GetSDKVersion()[0] |
231 elif options.sdk_revision: | 230 elif options.sdk_revision: |
232 out = GetSDKVersion()[1] | 231 out = GetSDKVersion()[1] |
233 elif options.check_version: | 232 elif options.check_version: |
234 required_version = ParseVersion(options.check_version) | 233 required_version = ParseVersion(options.check_version) |
235 version = GetSDKVersion() | 234 version = GetSDKVersion() |
236 if version < required_version: | 235 # We currently ignore the revision and just check the major version number. |
237 raise Error("SDK version too old (current: %s.%s, required: %s.%s)" | 236 # Currently, version[1] is just a Git hash, which cannot be compared. |
238 % (version[0], version[1], | 237 # TODO(mgiuca): Compare the minor revision numbers (which should be |
239 required_version[0], required_version[1])) | 238 # Cr-Commit-Position values), when http://crbug.com/406783 is fixed. |
| 239 # Then Cr-Commit-Position should be available: see http://crbug.com/406993. |
| 240 if version[0] < required_version[0]: |
| 241 raise Error("SDK version too old (current: %s, required: %s)" |
| 242 % (version[0], required_version[0])) |
240 out = None | 243 out = None |
241 | 244 |
242 if out: | 245 if out: |
243 print out | 246 print out |
244 return 0 | 247 return 0 |
245 | 248 |
246 | 249 |
247 if __name__ == '__main__': | 250 if __name__ == '__main__': |
248 try: | 251 try: |
249 sys.exit(main(sys.argv[1:])) | 252 sys.exit(main(sys.argv[1:])) |
250 except Error as e: | 253 except Error as e: |
251 sys.stderr.write(str(e) + '\n') | 254 sys.stderr.write(str(e) + '\n') |
252 sys.exit(1) | 255 sys.exit(1) |
OLD | NEW |