summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/compiler.py
diff options
context:
space:
mode:
authorcduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 16:09:16 +0000
committercduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 16:09:16 +0000
commitf656805bcc1e3996d3f6fccaa385ea2438d70003 (patch)
tree1eed90b43d01b712368ef3ff79f4d329fedd2c65 /tools/json_schema_compiler/compiler.py
parent9cfbf66521b2c1151d660a5b82f5183204663e5e (diff)
downloadchromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.zip
chromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.tar.gz
chromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.tar.bz2
Allow comments in extension config files.
Added a script to remove comments from the extension api JSON files before processing for the extension docs. We will now be able to comment in the JSON files, and they should be much easier to read. Also added the license header to all the JSON files. BUG=114233 TEST=Put comments in one of the JSON files and remake the docs. They will make with no problems. Review URL: http://codereview.chromium.org/9447090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/compiler.py')
-rw-r--r--tools/json_schema_compiler/compiler.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index 54ab62f..fb84a6c 100644
--- a/tools/json_schema_compiler/compiler.py
+++ b/tools/json_schema_compiler/compiler.py
@@ -19,7 +19,7 @@ Usage example:
import cc_generator
import cpp_type_generator
import h_generator
-import json
+from json_schema import LoadJSON
import model
import optparse
import os.path
@@ -49,8 +49,7 @@ if __name__ == '__main__':
# Actually generate for source file.
- with open(schema, 'r') as schema_file:
- api_defs = json.loads(schema_file.read())
+ api_defs = LoadJSON(schema)
for target_namespace in api_defs:
referenced_schemas = target_namespace.get('dependencies', [])
@@ -58,8 +57,7 @@ if __name__ == '__main__':
for referenced_schema in referenced_schemas:
referenced_schema_path = os.path.join(
os.path.dirname(schema), referenced_schema + '.json')
- with open(referenced_schema_path, 'r') as referenced_schema_file:
- referenced_api_defs = json.loads(referenced_schema_file.read())
+ referenced_api_defs = LoadJSON(referenced_schema_path)
for namespace in referenced_api_defs:
api_model.AddNamespace(namespace,