OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 posixpath | 5 import posixpath |
6 | 6 |
7 from api_models import GetNodeCategories | 7 from api_models import GetNodeCategories |
8 from api_schema_graph import APISchemaGraph | 8 from api_schema_graph import APISchemaGraph |
9 from branch_utility import BranchUtility, ChannelInfo | 9 from branch_utility import BranchUtility, ChannelInfo |
10 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode | 10 from compiled_file_system import CompiledFileSystem, SingleFile, Unicode |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 and returns it if found. | 167 and returns it if found. |
168 ''' | 168 ''' |
169 api_filename = _GetAPISchemaFilename(api_name, file_system, version) | 169 api_filename = _GetAPISchemaFilename(api_name, file_system, version) |
170 if api_filename is None: | 170 if api_filename is None: |
171 # No file for the API could be found in the given |file_system|. | 171 # No file for the API could be found in the given |file_system|. |
172 return None | 172 return None |
173 | 173 |
174 schema_fs = self._CreateAPISchemaFileSystem(file_system) | 174 schema_fs = self._CreateAPISchemaFileSystem(file_system) |
175 api_schemas = schema_fs.GetFromFile(api_filename).Get() | 175 api_schemas = schema_fs.GetFromFile(api_filename).Get() |
176 matching_schemas = [api for api in api_schemas | 176 matching_schemas = [api for api in api_schemas |
177 if api['namespace'] == api_name] | 177 if api and api['namespace'] == api_name] |
178 # There should only be a single matching schema per file, or zero in the | 178 # There should only be a single matching schema per file, or zero in the |
179 # case of no API data being found in _EXTENSION_API. | 179 # case of no API data being found in _EXTENSION_API. |
180 assert len(matching_schemas) <= 1 | 180 assert len(matching_schemas) <= 1 |
181 return matching_schemas or None | 181 return matching_schemas or None |
182 | 182 |
183 def _HasAPISchema(self, api_name, file_system, version): | 183 def _HasAPISchema(self, api_name, file_system, version): |
184 '''Whether or not an API schema for |api_name| exists in the given | 184 '''Whether or not an API schema for |api_name| exists in the given |
185 |file_system|. | 185 |file_system|. |
186 ''' | 186 ''' |
187 filename = _GetAPISchemaFilename(api_name, file_system, version) | 187 filename = _GetAPISchemaFilename(api_name, file_system, version) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 # Continue looping until there are no longer differences between this | 448 # Continue looping until there are no longer differences between this |
449 # version and master. | 449 # version and master. |
450 return version_stat != master_stat | 450 return version_stat != master_stat |
451 | 451 |
452 self._file_system_iterator.Ascending( | 452 self._file_system_iterator.Ascending( |
453 self.GetAPIAvailability(api_name).channel_info, | 453 self.GetAPIAvailability(api_name).channel_info, |
454 update_availability_graph) | 454 update_availability_graph) |
455 | 455 |
456 self._node_level_object_store.Set(api_name, availability_graph) | 456 self._node_level_object_store.Set(api_name, availability_graph) |
457 return availability_graph | 457 return availability_graph |
OLD | NEW |