Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / tools / android_version.py
blobda28bb13e5f4ef0772430e4f866ea4143735d12c
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Converts a dotted-quad version string to a single numeric value suitable for
7 an Android package's internal version number."""
9 import sys
11 def main():
12 if len(sys.argv) != 2:
13 print "Usage: %s version-string" % sys.argv[0]
14 exit(1)
16 version_string = sys.argv[1]
17 version_components = version_string.split('.')
18 if len(version_components) != 4:
19 print "Expected 4 components."
20 exit(1)
22 branch = int(version_components[2])
23 patch = int(version_components[3])
24 print branch * 1000 + patch
27 if __name__ == '__main__':
28 main()