OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Creates chrome_version.cc which contains the definition of the | 7 # Creates chrome_version.cc which contains the definition of the |
8 # kChromeVersion constant. | 8 # kChromeVersion constant. |
9 | 9 |
10 import sys | 10 import sys |
11 | 11 |
12 def main(me, args): | 12 def main(me, args): |
13 if len(args) != 2: | 13 if len(args) != 2: |
14 print >>sys.stderr, 'usage: %s version.cc version' % me | 14 print >>sys.stderr, 'usage: %s version.cc version' % me |
15 return 1 | 15 return 1 |
16 | 16 |
17 (cc_file, version) = args | 17 (cc_file, version) = args |
18 | 18 |
19 contents = '''// automatically generated by %s | 19 contents = '''// automatically generated by %s |
20 | 20 |
21 namespace chrome { | 21 namespace chrome { |
22 | 22 |
23 extern const char kChromeVersion[] = "%s"; | 23 const char kChromeVersion[] = "%s"; |
24 | 24 |
25 } // namespace chrome | 25 } // namespace chrome |
26 ''' % (me, version) | 26 ''' % (me, version) |
27 | 27 |
28 output = open(cc_file, 'w') | 28 output = open(cc_file, 'w') |
29 output.write(contents) | 29 output.write(contents) |
30 output.close() | 30 output.close() |
31 | 31 |
32 return 0 | 32 return 0 |
33 | 33 |
34 if __name__ == '__main__': | 34 if __name__ == '__main__': |
35 sys.exit(main(sys.argv[0], sys.argv[1:])) | 35 sys.exit(main(sys.argv[0], sys.argv[1:])) |
OLD | NEW |