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 from collections import Mapping | 5 from collections import Mapping |
6 import posixpath | 6 import posixpath |
7 | 7 |
8 from api_schema_graph import APISchemaGraph | 8 from api_schema_graph import APISchemaGraph |
9 from branch_utility import BranchUtility | 9 from branch_utility import BranchUtility |
10 from extensions_paths import API, CHROME_API, JSON_TEMPLATES | 10 from extensions_paths import API_PATHS, JSON_TEMPLATES |
11 from features_bundle import FeaturesBundle | 11 from features_bundle import FeaturesBundle |
12 import features_utility | 12 import features_utility |
13 from file_system import FileNotFoundError | 13 from file_system import FileNotFoundError |
14 from third_party.json_schema_compiler.model import UnixName | 14 from third_party.json_schema_compiler.model import UnixName |
15 | 15 |
16 | 16 |
17 _EXTENSION_API = 'extension_api.json' | 17 _EXTENSION_API = 'extension_api.json' |
18 | 18 |
19 # The version where api_features.json is first available. | 19 # The version where api_features.json is first available. |
20 _API_FEATURES_MIN_VERSION = 28 | 20 _API_FEATURES_MIN_VERSION = 28 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 '''Gets the name of the file which may contain the schema for |api_name| in | 74 '''Gets the name of the file which may contain the schema for |api_name| in |
75 |file_system|, or None if the API is not found. Note that this may be the | 75 |file_system|, or None if the API is not found. Note that this may be the |
76 single _EXTENSION_API file which all APIs share in older versions of Chrome, | 76 single _EXTENSION_API file which all APIs share in older versions of Chrome, |
77 in which case it is unknown whether the API actually exists there. | 77 in which case it is unknown whether the API actually exists there. |
78 ''' | 78 ''' |
79 if version == 'trunk' or version > _ORIGINAL_FEATURES_MIN_VERSION: | 79 if version == 'trunk' or version > _ORIGINAL_FEATURES_MIN_VERSION: |
80 # API schema filenames switch format to unix_hacker_style. | 80 # API schema filenames switch format to unix_hacker_style. |
81 api_name = UnixName(api_name) | 81 api_name = UnixName(api_name) |
82 | 82 |
83 futures = [(path, file_system.ReadSingle(path)) | 83 futures = [(path, file_system.ReadSingle(path)) |
84 for path in (CHROME_API, API)] | 84 for path in API_PATHS] |
85 for path, future in futures: | 85 for path, future in futures: |
86 try: | 86 try: |
87 filenames = future.Get() | 87 filenames = future.Get() |
88 for ext in ('json', 'idl'): | 88 for ext in ('json', 'idl'): |
89 filename = '%s.%s' % (api_name, ext) | 89 filename = '%s.%s' % (api_name, ext) |
90 if filename in filenames: | 90 if filename in filenames: |
91 return path + filename | 91 return path + filename |
92 if _EXTENSION_API in filenames: | 92 if _EXTENSION_API in filenames: |
93 return path + _EXTENSION_API | 93 return path + _EXTENSION_API |
94 except FileNotFoundError: | 94 except FileNotFoundError: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 # Continue looping until there are no longer differences between this | 283 # Continue looping until there are no longer differences between this |
284 # version and trunk. | 284 # version and trunk. |
285 return version_stat != trunk_stat | 285 return version_stat != trunk_stat |
286 | 286 |
287 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), | 287 self._file_system_iterator.Ascending(self.GetApiAvailability(api_name), |
288 update_availability_graph) | 288 update_availability_graph) |
289 | 289 |
290 self._node_level_object_store.Set(api_name, availability_graph) | 290 self._node_level_object_store.Set(api_name, availability_graph) |
291 return availability_graph | 291 return availability_graph |
OLD | NEW |