OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright 2015 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. | |
5 | |
6 import os | |
7 import sys | |
8 import hashlib | |
9 | |
10 in_file = sys.argv[1] | |
11 out_file = sys.argv[2] | |
12 | |
13 out_dir = os.path.dirname(out_file) | |
14 | |
15 data = None | |
16 with open(in_file, "rb") as f: | |
17 data = f.read() | |
18 | |
19 if not os.path.exists(out_dir): | |
20 os.makedirs(out_dir) | |
21 | |
22 sha1hash = hashlib.sha1(data).hexdigest() | |
23 | |
24 with open(out_file, "w") as f: | |
25 f.write('#include "mojo/icu/constants.h"\n') | |
26 f.write("namespace mojo {\n") | |
27 f.write("namespace icu {\n") | |
28 f.write("const size_t kDataSize = %s;\n" % len(data)) | |
29 f.write("const char kDataHash[] = \"%s\";\n" % sha1hash) | |
30 f.write("\n} // namespace icu\n") | |
31 f.write("\n} // namespace mojo\n") | |
OLD | NEW |