Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: services/icu_data/embed_icu_data.py

Issue 854433002: Update the sha1hash of the ICU data table (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import os 6 import os
7 import sys 7 import sys
8 import hashlib 8 import hashlib
9 9
10 in_file = sys.argv[1] 10 in_file = sys.argv[1]
(...skipping 12 matching lines...) Expand all
23 23
24 values = ["0x%02x" % ord(c) for c in data] 24 values = ["0x%02x" % ord(c) for c in data]
25 lines = [] 25 lines = []
26 chunk_size = 16 26 chunk_size = 16
27 for i in range(0, len(values), chunk_size): 27 for i in range(0, len(values), chunk_size):
28 lines.append(", ".join(values[i: i + chunk_size])) 28 lines.append(", ".join(values[i: i + chunk_size]))
29 29
30 with open(out_file, "w") as f: 30 with open(out_file, "w") as f:
31 f.write('#include "services/icu_data/data.h"\n') 31 f.write('#include "services/icu_data/data.h"\n')
32 f.write("namespace icu_data {\n") 32 f.write("namespace icu_data {\n")
33 f.write("const char kICUDataTable[] = {\n") 33 f.write("const char kICUDataTable[%d] = {\n" % len(data))
34 f.write(",\n".join(lines)) 34 f.write(",\n".join(lines))
35 f.write("\n};\n") 35 f.write("\n};\n")
36 f.write("const size_t kICUDataTableSize = sizeof(kICUDataTable);\n") 36 f.write("const size_t kICUDataTableSize = sizeof(kICUDataTable);\n")
37 f.write("const char kICUDataTableHash[] = \"%s\";\n" % sha1hash) 37 f.write("const char kICUDataTableHash[] = \"%s\";\n" % sha1hash)
38 f.write("}\n") 38 f.write("}\n")
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698