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

Unified Diff: tools/json_schema_compiler/schema_loader.py

Issue 197873009: Support scoped types in PPAPI IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed schema loader for Chromiums API idls. Created 6 years, 9 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: tools/json_schema_compiler/schema_loader.py
diff --git a/tools/json_schema_compiler/schema_loader.py b/tools/json_schema_compiler/schema_loader.py
index 9fea1ab8250229a47172e7a18dabd26968ee6166..881074300bd0b296f8a712b39b3a6b18cc6409f7 100644
--- a/tools/json_schema_compiler/schema_loader.py
+++ b/tools/json_schema_compiler/schema_loader.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import os
+import re
import sys
import idl_schema
@@ -30,8 +31,14 @@ class SchemaLoader(object):
return default_namespace
namespace_name, type_name = name_parts
real_name = None
+ # Try to find the file defining the namespace. Eg. for
+ # nameSpace.sub_name_space.Type' the following heuristics looks for:
+ # 1. name_space_sub_name_space.json,
+ # 2. name_space_sub_name_space.idl.
for ext in ['json', 'idl']:
- filename = '%s.%s' % (namespace_name, ext)
+ basename = re.sub('(?!^)([A-Z]+)', r'_\1',
+ namespace_name.replace('.', '_')).lower()
not at google - send to devlin 2014/03/28 18:42:25 there is already a helper for this sort of thing i
mtomasz 2014/03/31 01:39:20 Done.
+ filename = '%s.%s' % (basename, ext)
filepath = os.path.join(self._real_path, filename);
if os.path.exists(filepath):
real_name = filename

Powered by Google App Engine
This is Rietveld 408576698