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 collections | 5 import collections |
6 import os | 6 import os |
7 | 7 |
8 from branch_utility import BranchUtility | 8 from branch_utility import BranchUtility |
9 from compiled_file_system import CompiledFileSystem | 9 from compiled_file_system import CompiledFileSystem |
10 from file_system import FileNotFoundError | 10 from file_system import FileNotFoundError |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 return version + 1 | 154 return version + 1 |
155 available = False | 155 available = False |
156 features_fs, names_fs = self._CreateFeaturesAndNamesFileSystems(version) | 156 features_fs, names_fs = self._CreateFeaturesAndNamesFileSystems(version) |
157 if version >= 28: | 157 if version >= 28: |
158 # The _api_features.json file first appears in version 28 and should be | 158 # The _api_features.json file first appears in version 28 and should be |
159 # the most reliable for finding API availabilities, so it gets checked | 159 # the most reliable for finding API availabilities, so it gets checked |
160 # first. The _permission_features.json and _manifest_features.json files | 160 # first. The _permission_features.json and _manifest_features.json files |
161 # are present in Chrome 20 and onwards. Fall back to a check for file | 161 # are present in Chrome 20 and onwards. Fall back to a check for file |
162 # system existence if the API is not stable in any of the _features.json | 162 # system existence if the API is not stable in any of the _features.json |
163 # files. | 163 # files. |
164 available = _GetChannelFromApiFeatures(api_name, features_fs) == _STABLE | 164 available = _GetChannelFromApiFeatures(api_name, features_fs) |
165 if version >= 20: | 165 if version >= 20: |
166 # Check other _features.json files/file existence if the API wasn't | 166 # Check other _features.json files/file existence if the API wasn't |
167 # found in _api_features.json, or if _api_features.json wasn't present. | 167 # found in _api_features.json, or if _api_features.json wasn't present. |
168 available = available or ( | 168 available = available or ( |
169 _GetChannelFromPermissionFeatures(api_name, features_fs) == _STABLE | 169 _GetChannelFromPermissionFeatures(api_name, features_fs) |
170 or _GetChannelFromManifestFeatures(api_name, features_fs) == _STABLE | 170 or _GetChannelFromManifestFeatures(api_name, features_fs)) |
171 or _ExistsInFileSystem(api_name, names_fs)) | 171 if available is None: |
172 available = _ExistsInFileSystem(api_name, names_fs) | |
173 else: | |
174 available = available == _STABLE | |
epeterson
2013/07/03 19:05:02
There was a bug here: file system existence was ch
not at google - send to devlin
2013/07/03 19:54:56
Cool, nice catch.
But I don't like the way that a
epeterson
2013/07/09 20:51:18
Done. Also updated 'channel' to 'available_channel
| |
172 elif version >= 18: | 175 elif version >= 18: |
173 # These versions are a little troublesome. Version 19 has | 176 # These versions are a little troublesome. Version 19 has |
174 # _permission_features.json, but it lacks 'channel' information. | 177 # _permission_features.json, but it lacks 'channel' information. |
175 # Version 18 lacks all of the _features.json files. For now, we're using | 178 # Version 18 lacks all of the _features.json files. For now, we're using |
176 # a simple check for filesystem existence here. | 179 # a simple check for filesystem existence here. |
177 available = _ExistsInFileSystem(api_name, names_fs) | 180 available = _ExistsInFileSystem(api_name, names_fs) |
178 elif version >= 5: | 181 elif version >= 5: |
179 # Versions 17 and down to 5 have an extension_api.json file which | 182 # Versions 17 and down to 5 have an extension_api.json file which |
180 # contains namespaces for each API that was available at the time. We | 183 # contains namespaces for each API that was available at the time. We |
181 # can use this file to check for API existence. | 184 # can use this file to check for API existence. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 | 241 |
239 # If the API is in stable, find the chrome version in which it became | 242 # If the API is in stable, find the chrome version in which it became |
240 # stable. | 243 # stable. |
241 if availability.channel == _STABLE: | 244 if availability.channel == _STABLE: |
242 availability.version = self._FindEarliestStableAvailability( | 245 availability.version = self._FindEarliestStableAvailability( |
243 api_name, | 246 api_name, |
244 availability.version) | 247 availability.version) |
245 | 248 |
246 self._object_store.Set(api_name, availability) | 249 self._object_store.Set(api_name, availability) |
247 return availability | 250 return availability |
OLD | NEW |