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."""
12 if len(sys
.argv
) != 2:
13 print "Usage: %s version-string" % sys
.argv
[0]
16 version_string
= sys
.argv
[1]
17 version_components
= version_string
.split('.')
18 if len(version_components
) != 4:
19 print "Expected 4 components."
22 branch
= int(version_components
[2])
23 patch
= int(version_components
[3])
24 print branch
* 1000 + patch
27 if __name__
== '__main__':