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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/build/xxd.py

Issue 2295913003: [DevTools] Switch from platform/v8_inspector to v8/v8-inspector.h. (Closed)
Patch Set: rebase Created 4 years, 3 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
(Empty)
1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 """Represent a file as a C++ constant string.
6
7 Usage:
8 python xxd.py VAR SOURCE DEST
9 """
10
11
12 import sys
13 import rjsmin
14
15
16 def main():
17 variable_name, input_filename, output_filename = sys.argv[1:]
18 with open(input_filename) as input_file:
19 input_text = input_file.read()
20 input_text = rjsmin.jsmin(input_text)
21 hex_values = ['0x{0:02x}'.format(ord(char)) for char in input_text]
22 const_declaration = 'const char %s[] = {\n%s\n};\n' % (
23 variable_name, ', '.join(hex_values))
24 with open(output_filename, 'w') as output_file:
25 output_file.write(const_declaration)
26
27 if __name__ == '__main__':
28 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698