| 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 Cache, CompiledFileSystem, SingleFile, Unicode | 10 from compiled_file_system import Cache, CompiledFileSystem, SingleFile, Unicode |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 self._schema_processor = schema_processor_factory.Create(True) | 137 self._schema_processor = schema_processor_factory.Create(True) |
| 138 | 138 |
| 139 def _GetPredeterminedNodeAvailability(self, node_name): | 139 def _GetPredeterminedNodeAvailability(self, node_name): |
| 140 '''Checks a configuration file for hardcoded (i.e. predetermined) | 140 '''Checks a configuration file for hardcoded (i.e. predetermined) |
| 141 availability information for an API node. | 141 availability information for an API node. |
| 142 ''' | 142 ''' |
| 143 node_info = self._json_fs.GetFromFile( | 143 node_info = self._json_fs.GetFromFile( |
| 144 JSON_TEMPLATES + 'api_availabilities.json').Get().get(node_name) | 144 JSON_TEMPLATES + 'api_availabilities.json').Get().get(node_name) |
| 145 if node_info is None: | 145 if node_info is None: |
| 146 return None | 146 return None |
| 147 |
| 148 channel_info = None |
| 147 if node_info['channel'] == 'stable': | 149 if node_info['channel'] == 'stable': |
| 148 return AvailabilityInfo( | 150 channel_info = self._branch_utility.GetStableChannelInfo( |
| 149 self._branch_utility.GetStableChannelInfo(node_info['version'])) | 151 node_info['version']) |
| 150 return AvailabilityInfo( | 152 else: |
| 151 self._branch_utility.GetChannelInfo(node_info['channel'])) | 153 channel_info = self._branch_utility.GetChannelInfo(node_info['channel']) |
| 154 return AvailabilityInfo(channel_info) if channel_info else None |
| 152 | 155 |
| 153 @memoize | 156 @memoize |
| 154 def _CreateAPISchemaFileSystem(self, file_system): | 157 def _CreateAPISchemaFileSystem(self, file_system): |
| 155 '''Creates a CompiledFileSystem for parsing raw JSON or IDL API schema | 158 '''Creates a CompiledFileSystem for parsing raw JSON or IDL API schema |
| 156 data and formatting it so that it can be used to create APISchemaGraphs. | 159 data and formatting it so that it can be used to create APISchemaGraphs. |
| 157 ''' | 160 ''' |
| 158 def process_schema(path, data): | 161 def process_schema(path, data): |
| 159 return self._schema_processor.Process(path, data) | 162 return self._schema_processor.Process(path, data) |
| 160 return self._compiled_fs_factory.Create( | 163 return self._compiled_fs_factory.Create( |
| 161 file_system, | 164 file_system, |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 # Continue looping until there are no longer differences between this | 458 # Continue looping until there are no longer differences between this |
| 456 # version and master. | 459 # version and master. |
| 457 return version_stat != master_stat | 460 return version_stat != master_stat |
| 458 | 461 |
| 459 self._file_system_iterator.Ascending( | 462 self._file_system_iterator.Ascending( |
| 460 self.GetAPIAvailability(api_name).channel_info, | 463 self.GetAPIAvailability(api_name).channel_info, |
| 461 update_availability_graph) | 464 update_availability_graph) |
| 462 | 465 |
| 463 self._node_level_object_store.Set(api_name, availability_graph) | 466 self._node_level_object_store.Set(api_name, availability_graph) |
| 464 return availability_graph | 467 return availability_graph |
| OLD | NEW |