| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 os | 8 import os |
| 9 import os.path | 9 import os.path |
| 10 import shutil | 10 import shutil |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 raise Exception("--page-name argument must be one of %s." % | 197 raise Exception("--page-name argument must be one of %s." % |
| 198 ', '.join(sorted(page_names))) | 198 ', '.join(sorted(page_names))) |
| 199 | 199 |
| 200 # Render a manifest file containing metadata about all the extension samples | 200 # Render a manifest file containing metadata about all the extension samples |
| 201 samples_manifest = SamplesManifest(_samples_dir, _base_dir, api_manifest) | 201 samples_manifest = SamplesManifest(_samples_dir, _base_dir, api_manifest) |
| 202 samples_manifest.writeToFile(_samples_json) | 202 samples_manifest.writeToFile(_samples_json) |
| 203 | 203 |
| 204 # Write zipped versions of the samples listed in the manifest to the | 204 # Write zipped versions of the samples listed in the manifest to the |
| 205 # filesystem, unless the user has disabled it | 205 # filesystem, unless the user has disabled it |
| 206 if options.zips: | 206 if options.zips: |
| 207 samples_manifest.writeZippedSamples() | 207 modified_zips = samples_manifest.writeZippedSamples() |
| 208 else: |
| 209 modified_zips = [] |
| 208 | 210 |
| 209 modified_files = RenderPages(page_names, test_shell) | 211 modified_files = RenderPages(page_names, test_shell) |
| 212 modified_files.extend(modified_zips) |
| 210 | 213 |
| 211 if (len(modified_files) == 0): | 214 if len(modified_files) == 0: |
| 212 print "Output files match existing files. No changes made." | 215 print "Output files match existing files. No changes made." |
| 213 else: | 216 else: |
| 214 print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + | 217 print ("ATTENTION: EXTENSION DOCS HAVE CHANGED\n" + |
| 215 "The following files have been modified and should be checked\n" + | 218 "The following files have been modified and should be checked\n" + |
| 216 "into source control (ideally in the same changelist as the\n" + | 219 "into source control (ideally in the same changelist as the\n" + |
| 217 "underlying files that resulting in their changing).") | 220 "underlying files that resulting in their changing).") |
| 218 for f in modified_files: | 221 for f in modified_files: |
| 219 print f | 222 print " * %s" % f |
| 220 | 223 |
| 221 # Hack. Sleep here, otherwise windows doesn't properly close the debug.log | 224 # Hack. Sleep here, otherwise windows doesn't properly close the debug.log |
| 222 # and the os.remove will fail with a "Permission denied". | 225 # and the os.remove will fail with a "Permission denied". |
| 223 time.sleep(1) | 226 time.sleep(1) |
| 224 debug_log = os.path.normpath(_build_dir + "/" + "debug.log") | 227 debug_log = os.path.normpath(_build_dir + "/" + "debug.log") |
| 225 if (os.path.isfile(debug_log)): | 228 if (os.path.isfile(debug_log)): |
| 226 os.remove(debug_log) | 229 os.remove(debug_log) |
| 227 | 230 |
| 228 if 'EX_OK' in dir(os): | 231 if 'EX_OK' in dir(os): |
| 229 return os.EX_OK | 232 return os.EX_OK |
| 230 else: | 233 else: |
| 231 return 0 | 234 return 0 |
| 232 | 235 |
| 233 if __name__ == '__main__': | 236 if __name__ == '__main__': |
| 234 sys.exit(main()) | 237 sys.exit(main()) |
| OLD | NEW |