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

Side by Side Diff: mojo/icu/generate_icu_constants.py

Issue 2010853002: Delete //mojo/icu. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « mojo/icu/constants.h ('k') | mojo/icu/icu.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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")
OLDNEW
« no previous file with comments | « mojo/icu/constants.h ('k') | mojo/icu/icu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698