summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/compiler.py
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 17:26:54 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 17:26:54 +0000
commit836a7e224691d75571f754e1749f434d76f1692d (patch)
tree3ddbba7f87161af43f106011f37ea191fed54212 /tools/json_schema_compiler/compiler.py
parent7ec7ecbf9f9223c1c27c88f49aac863a28903ca3 (diff)
downloadchromium_src-836a7e224691d75571f754e1749f434d76f1692d.zip
chromium_src-836a7e224691d75571f754e1749f434d76f1692d.tar.gz
chromium_src-836a7e224691d75571f754e1749f434d76f1692d.tar.bz2
Revert 124660 - 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 TBR=cduvall@chromium.org Review URL: https://chromiumcodereview.appspot.com/9582013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124675 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, 5 insertions, 3 deletions
diff --git a/tools/json_schema_compiler/compiler.py b/tools/json_schema_compiler/compiler.py
index fb84a6c..54ab62f 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
-from json_schema import LoadJSON
+import json
import model
import optparse
import os.path
@@ -49,7 +49,8 @@ if __name__ == '__main__':
# Actually generate for source file.
- api_defs = LoadJSON(schema)
+ with open(schema, 'r') as schema_file:
+ api_defs = json.loads(schema_file.read())
for target_namespace in api_defs:
referenced_schemas = target_namespace.get('dependencies', [])
@@ -57,7 +58,8 @@ if __name__ == '__main__':
for referenced_schema in referenced_schemas:
referenced_schema_path = os.path.join(
os.path.dirname(schema), referenced_schema + '.json')
- referenced_api_defs = LoadJSON(referenced_schema_path)
+ with open(referenced_schema_path, 'r') as referenced_schema_file:
+ referenced_api_defs = json.loads(referenced_schema_file.read())
for namespace in referenced_api_defs:
api_model.AddNamespace(namespace,