Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: ppapi/generators/idl_namespace.py

Issue 7751001: More multi-version support (part 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/generators/idl_c_proto.py ('k') | ppapi/generators/idl_node.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 self.release_to_version[release] = version 112 self.release_to_version[release] = version
113 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()) 114 self.releases = sorted(self.release_to_version.keys())
115 115
116 def GetRelease(self, version): 116 def GetRelease(self, version):
117 # Check for exact match 117 # Check for exact match
118 if version in self.versions: 118 if version in self.versions:
119 return self.version_to_release[version] 119 return self.version_to_release[version]
120 120
121 def GetVersion(self, release): 121 def GetVersion(self, release):
122 if release > self.releases[-1]:
123 release = self.releases[-1]
124 elif release < self.releases[0]:
125 release = self.releases[0]
122 return self.release_to_version[release] 126 return self.release_to_version[release]
123 127
124 128
125 129
126 # 130 #
127 # IDLNamespace 131 # IDLNamespace
128 # 132 #
129 # IDLNamespace provides a mapping between a symbol name and an IDLVersionList 133 # IDLNamespace provides a mapping between a symbol name and an IDLVersionList
130 # which contains IDLVersion objects. It provides an interface for fetching 134 # which contains IDLVersion objects. It provides an interface for fetching
131 # one or more IDLNodes based on a version or range of versions. 135 # one or more IDLNodes based on a version or range of versions.
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 345
342 if errors: 346 if errors:
343 print 'Test failed with %d errors.' % errors 347 print 'Test failed with %d errors.' % errors
344 else: 348 else:
345 print 'Passed.' 349 print 'Passed.'
346 return errors 350 return errors
347 351
348 if __name__ == '__main__': 352 if __name__ == '__main__':
349 sys.exit(Main(sys.argv[1:])) 353 sys.exit(Main(sys.argv[1:]))
350 354
OLDNEW
« no previous file with comments | « ppapi/generators/idl_c_proto.py ('k') | ppapi/generators/idl_node.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698