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

Unified Diff: third_party/inspector_protocol/ConcatenateProtocols.py

Issue 2447323002: [inspector] use own copy of third_party/inspector_protocol (Closed)
Patch Set: updated README.v8 Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: third_party/inspector_protocol/ConcatenateProtocols.py
diff --git a/third_party/inspector_protocol/ConcatenateProtocols.py b/third_party/inspector_protocol/ConcatenateProtocols.py
new file mode 100755
index 0000000000000000000000000000000000000000..a7cbc992c76e4010d3053f25c63c51f3c28133b0
--- /dev/null
+++ b/third_party/inspector_protocol/ConcatenateProtocols.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os.path
+import sys
+
+try:
+ import json
+except ImportError:
+ import simplejson as json
+
+
+def main(argv):
+ if len(argv) < 1:
+ sys.stderr.write("Usage: %s <protocol-1> [<protocol-2> [, <protocol-3>...]] <output-file>\n" % sys.argv[0])
+ return 1
+
+ domains = []
+ version = None
+ for protocol in argv[:-1]:
+ file_name = os.path.normpath(protocol)
+ if not os.path.isfile(file_name):
+ sys.stderr.write("Cannot find %s\n" % file_name)
+ return 1
+ input_file = open(file_name, "r")
+ json_string = input_file.read()
+ parsed_json = json.loads(json_string)
+ domains += parsed_json["domains"]
+ version = parsed_json["version"]
+
+ output_file = open(argv[-1], "w")
+ json.dump({"version": version, "domains": domains}, output_file, indent=4, sort_keys=False, separators=(',', ': '))
+ output_file.close()
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))

Powered by Google App Engine
This is Rietveld 408576698