Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / libaddressinput / chromium / tools / update-strings.py
blob44e8351087f907b13f91b3829e5be3f76ef70428
1 #!/usr/bin/env python
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 # This script updates the address_input_strings.grdp file based on the strings
8 # in libaddressinput.
10 import os
11 import sys
13 HEADER = """<!--
15 DO NOT MODIFY.
17 This file is generated by
18 third_party/libaddressinput/chromium/tools/update-strings.py from
19 src/third_party/libaddressinput/src/cpp/res/messages.grdp. Submit modifications
20 to the upstream library at https://github.com/googlei18n/libaddressinput.
22 -->
23 """
25 script_dir = os.path.dirname(os.path.realpath(__file__))
26 from_file = os.path.abspath(os.path.join(
27 script_dir, os.pardir, os.pardir, 'src', 'cpp', 'res', 'messages.grdp'))
28 to_file = os.path.abspath(os.path.join(
29 script_dir, os.pardir, os.pardir, os.pardir, os.pardir, 'chrome', 'app',
30 'address_input_strings.grdp'))
32 with open(from_file, 'r') as source:
33 with open(to_file, 'w') as destination:
34 destination.write(source.readline()) # XML declaration.
35 destination.write(HEADER)
36 destination.write(source.read())