OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # | 2 # |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """ | 7 """ |
8 IDLNamespace for PPAPI | 8 IDLNamespace for PPAPI |
9 | 9 |
10 This file defines the behavior of the AST namespace which allows for resolving | 10 This file defines the behavior of the AST namespace which allows for resolving |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 # IDLVersionMap | 98 # IDLVersionMap |
99 # | 99 # |
100 # A version map, can map from an float interface version, to a global | 100 # A version map, can map from an float interface version, to a global |
101 # release string. | 101 # release string. |
102 # | 102 # |
103 class IDLVersionMap(object): | 103 class IDLVersionMap(object): |
104 def __init__(self): | 104 def __init__(self): |
105 self.version_to_release = {} | 105 self.version_to_release = {} |
106 self.release_to_version = {} | 106 self.release_to_version = {} |
107 self.versions = [] | 107 self.versions = [] |
| 108 self.releases = [] |
108 | 109 |
109 def AddReleaseVersionMapping(self, release, version): | 110 def AddReleaseVersionMapping(self, release, version): |
110 self.version_to_release[version] = release | 111 self.version_to_release[version] = release |
111 self.release_to_version[release] = version | 112 self.release_to_version[release] = version |
112 self.versions = sorted(self.version_to_release.keys()) | 113 self.versions = sorted(self.version_to_release.keys()) |
| 114 self.releases = sorted(self.release_to_version.keys()) |
113 | 115 |
114 def GetRelease(self, version): | 116 def GetRelease(self, version): |
115 # Check for exact match | 117 # Check for exact match |
116 if version in self.versions: | 118 if version in self.versions: |
117 return self.version_to_release[version] | 119 return self.version_to_release[version] |
118 | 120 |
119 def GetVersion(self, release): | 121 def GetVersion(self, release): |
120 return self.release_to_version[release] | 122 return self.release_to_version[release] |
121 | 123 |
122 | 124 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 341 |
340 if errors: | 342 if errors: |
341 print 'Test failed with %d errors.' % errors | 343 print 'Test failed with %d errors.' % errors |
342 else: | 344 else: |
343 print 'Passed.' | 345 print 'Passed.' |
344 return errors | 346 return errors |
345 | 347 |
346 if __name__ == '__main__': | 348 if __name__ == '__main__': |
347 sys.exit(Main(sys.argv[1:])) | 349 sys.exit(Main(sys.argv[1:])) |
348 | 350 |
OLD | NEW |