OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Class for parsing metadata about extension samples.""" | 6 """Class for parsing metadata about extension samples.""" |
7 | 7 |
8 import locale | 8 import locale |
9 import os | 9 import os |
10 import os.path | 10 import os.path |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 methods = [] | 115 methods = [] |
116 api_dict = {} | 116 api_dict = {} |
117 namespace = module['namespace'] | 117 namespace = module['namespace'] |
118 if module.has_key('nodoc'): | 118 if module.has_key('nodoc'): |
119 return api_dict | 119 return api_dict |
120 if key not in self._MODULE_DOC_KEYS: | 120 if key not in self._MODULE_DOC_KEYS: |
121 raise Exception("key %s must be one of %s" % (key, self._MODULE_DOC_KEYS)) | 121 raise Exception("key %s must be one of %s" % (key, self._MODULE_DOC_KEYS)) |
122 if module.has_key(key): | 122 if module.has_key(key): |
123 methods.extend(module[key]) | 123 methods.extend(module[key]) |
124 for method in methods: | 124 for method in methods: |
| 125 if method.has_key('nodoc'): |
| 126 continue |
125 method_name = 'chrome.%s.%s' % (namespace, method['name']) | 127 method_name = 'chrome.%s.%s' % (namespace, method['name']) |
126 hashprefix = 'method' | 128 hashprefix = 'method' |
127 if key == 'events': | 129 if key == 'events': |
128 hashprefix = 'event' | 130 hashprefix = 'event' |
129 api_dict[method_name] = self._getDocLink(method_name, hashprefix) | 131 api_dict[method_name] = self._getDocLink(method_name, hashprefix) |
130 return api_dict | 132 return api_dict |
131 | 133 |
132 def getModuleNames(self): | 134 def getModuleNames(self): |
133 """ Returns the names of individual modules in the API. | 135 """ Returns the names of individual modules in the API. |
134 | 136 |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 zip_file.write(abspath, relpath) | 720 zip_file.write(abspath, relpath) |
719 if file == 'manifest.json': | 721 if file == 'manifest.json': |
720 info = zip_file.getinfo(zip_manifest_path) | 722 info = zip_file.getinfo(zip_manifest_path) |
721 info.comment = self['source_hash'] | 723 info.comment = self['source_hash'] |
722 except RuntimeError, msg: | 724 except RuntimeError, msg: |
723 raise Exception("Could not write zip at %s: %s" % (zip_path, msg)) | 725 raise Exception("Could not write zip at %s: %s" % (zip_path, msg)) |
724 finally: | 726 finally: |
725 zip_file.close() | 727 zip_file.close() |
726 | 728 |
727 return self._get_relative_zip_path() | 729 return self._get_relative_zip_path() |
OLD | NEW |