OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import copy | 5 import copy |
6 import logging | 6 import logging |
7 import os | 7 import os |
8 from collections import defaultdict, Mapping | 8 from collections import defaultdict, Mapping |
9 | 9 |
10 from branch_utility import BranchUtility | 10 from branch_utility import BranchUtility |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 dependencies = feature.get('dependencies') | 216 dependencies = feature.get('dependencies') |
217 if dependencies is None: | 217 if dependencies is None: |
218 return [] | 218 return [] |
219 | 219 |
220 def make_code_node(text): | 220 def make_code_node(text): |
221 return { 'class': 'code', 'text': text } | 221 return { 'class': 'code', 'text': text } |
222 | 222 |
223 permissions_content = [] | 223 permissions_content = [] |
224 manifest_content = [] | 224 manifest_content = [] |
225 | 225 |
226 for dependency in dependencies: | 226 def categorize_dependency(dependency): |
227 context, name = dependency.split(':', 1) | 227 context, name = dependency.split(':', 1) |
228 if context == 'permission': | 228 if context == 'permission': |
229 permissions_content.append(make_code_node('"%s"' % name)) | 229 permissions_content.append(make_code_node('"%s"' % name)) |
230 elif context == 'manifest': | 230 elif context == 'manifest': |
231 manifest_content.append(make_code_node('"%s": {...}' % name)) | 231 manifest_content.append(make_code_node('"%s": {...}' % name)) |
| 232 elif context == 'api': |
| 233 transitive_dependencies = ( |
| 234 self._api_features.get(context, {}).get('dependencies', [])) |
| 235 for transitive_dependency in transitive_dependencies: |
| 236 categorize_dependency(transitive_dependency) |
232 else: | 237 else: |
233 raise ValueError('Unrecognized dependency for %s: %s' | 238 raise ValueError('Unrecognized dependency for %s: %s' % ( |
234 % (self._namespace.name, context)) | 239 self._namespace.name, context)) |
| 240 |
| 241 for dependency in dependencies: |
| 242 categorize_dependency(dependency) |
235 | 243 |
236 dependency_rows = [] | 244 dependency_rows = [] |
237 if permissions_content: | 245 if permissions_content: |
238 dependency_rows.append({ | 246 dependency_rows.append({ |
239 'title': 'Permissions', | 247 'title': 'Permissions', |
240 'content': permissions_content | 248 'content': permissions_content |
241 }) | 249 }) |
242 if manifest_content: | 250 if manifest_content: |
243 dependency_rows.append({ | 251 dependency_rows.append({ |
244 'title': 'Manifest', | 252 'title': 'Manifest', |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 if self._disable_refs: | 623 if self._disable_refs: |
616 cache, ext = ( | 624 cache, ext = ( |
617 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else | 625 (self._idl_cache_no_refs, '.idl') if (unix_name in idl_names) else |
618 (self._json_cache_no_refs, '.json')) | 626 (self._json_cache_no_refs, '.json')) |
619 else: | 627 else: |
620 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else | 628 cache, ext = ((self._idl_cache, '.idl') if (unix_name in idl_names) else |
621 (self._json_cache, '.json')) | 629 (self._json_cache, '.json')) |
622 return self._GenerateHandlebarContext( | 630 return self._GenerateHandlebarContext( |
623 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), | 631 cache.GetFromFile('%s/%s%s' % (self._base_path, unix_name, ext)), |
624 path) | 632 path) |
OLD | NEW |