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 """Docbuilder for extension docs.""" | 6 """Docbuilder for extension docs.""" |
7 | 7 |
| 8 import glob |
8 import os | 9 import os |
9 import os.path | 10 import os.path |
10 import shutil | 11 import shutil |
11 import sys | 12 import sys |
12 import time | 13 import time |
13 import urllib | 14 import urllib |
14 | 15 |
15 from subprocess import Popen, PIPE | 16 from subprocess import Popen, PIPE |
16 from optparse import OptionParser | 17 from optparse import OptionParser |
17 | 18 |
18 _script_path = os.path.realpath(__file__) | 19 _script_path = os.path.realpath(__file__) |
19 _build_dir = os.path.dirname(_script_path) | 20 _build_dir = os.path.dirname(_script_path) |
20 _base_dir = os.path.normpath(_build_dir + "/..") | 21 _base_dir = os.path.normpath(_build_dir + "/..") |
21 _static_dir = _base_dir + "/static" | 22 _static_dir = _base_dir + "/static" |
22 _js_dir = _base_dir + "/js" | 23 _js_dir = _base_dir + "/js" |
23 _template_dir = _base_dir + "/template" | 24 _template_dir = _base_dir + "/template" |
24 _samples_dir = _base_dir + "/examples" | 25 _samples_dir = _base_dir + "/examples" |
25 _extension_api_dir = os.path.normpath(_base_dir + "/../api") | 26 _extension_api_dir = os.path.normpath(_base_dir + "/../api") |
26 | 27 |
27 _extension_api_json = _extension_api_dir + "/extension_api.json" | 28 _extension_api_json_schemas = glob.glob(_extension_api_dir + '/*.json') |
28 _devtools_api_json = _extension_api_dir + "/devtools_api.json" | |
29 _api_template_html = _template_dir + "/api_template.html" | 29 _api_template_html = _template_dir + "/api_template.html" |
30 _page_shell_html = _template_dir + "/page_shell.html" | 30 _page_shell_html = _template_dir + "/page_shell.html" |
31 _generator_html = _build_dir + "/generator.html" | 31 _generator_html = _build_dir + "/generator.html" |
32 _samples_json = _base_dir + "/samples.json" | 32 _samples_json = _base_dir + "/samples.json" |
33 | 33 |
34 _expected_output_preamble = "#BEGIN" | 34 _expected_output_preamble = "#BEGIN" |
35 _expected_output_postamble = "#END" | 35 _expected_output_postamble = "#END" |
36 | 36 |
37 # HACK! This is required because we can only depend on python 2.4 and | 37 # HACK! This is required because we can only depend on python 2.4 and |
38 # the calling environment may not be setup to set the PYTHONPATH | 38 # the calling environment may not be setup to set the PYTHONPATH |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 default=True) | 178 default=True) |
179 options, args = parser.parse_args() | 179 options, args = parser.parse_args() |
180 | 180 |
181 if (options.dump_render_tree_path and | 181 if (options.dump_render_tree_path and |
182 os.path.isfile(options.dump_render_tree_path)): | 182 os.path.isfile(options.dump_render_tree_path)): |
183 dump_render_tree = options.dump_render_tree_path | 183 dump_render_tree = options.dump_render_tree_path |
184 else: | 184 else: |
185 dump_render_tree = FindDumpRenderTree() | 185 dump_render_tree = FindDumpRenderTree() |
186 | 186 |
187 # Load the manifest of existing API Methods | 187 # Load the manifest of existing API Methods |
188 api_manifest = ApiManifest([_extension_api_json, _devtools_api_json]) | 188 api_manifest = ApiManifest(_extension_api_json_schemas) |
189 | 189 |
190 # Read static file names | 190 # Read static file names |
191 static_names = GetStaticFileNames() | 191 static_names = GetStaticFileNames() |
192 | 192 |
193 # Read module names | 193 # Read module names |
194 module_names = api_manifest.getModuleNames() | 194 module_names = api_manifest.getModuleNames() |
195 | 195 |
196 # All pages to generate | 196 # All pages to generate |
197 page_names = static_names | module_names | 197 page_names = static_names | module_names |
198 | 198 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (os.path.isfile(debug_log)): | 235 if (os.path.isfile(debug_log)): |
236 os.remove(debug_log) | 236 os.remove(debug_log) |
237 | 237 |
238 if 'EX_OK' in dir(os): | 238 if 'EX_OK' in dir(os): |
239 return os.EX_OK | 239 return os.EX_OK |
240 else: | 240 else: |
241 return 0 | 241 return 0 |
242 | 242 |
243 if __name__ == '__main__': | 243 if __name__ == '__main__': |
244 sys.exit(main()) | 244 sys.exit(main()) |
OLD | NEW |