| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 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 | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 import os.path | |
| 7 import sys | |
| 8 | |
| 9 def GenerateIncludeTag(resource_path): | |
| 10 (dir_name, file_name) = os.path.split(resource_path) | |
| 11 if (file_name.endswith('.js')): | |
| 12 return ' <script type="text/javascript" src="%s"></script>\n' % file_name | |
| 13 elif (file_name.endswith('.css')): | |
| 14 return ' <link rel="stylesheet" type="text/css" href="%s">\n' % file_name | |
| 15 else: | |
| 16 assert false | |
| 17 | |
| 18 | |
| 19 def main(argv): | |
| 20 | |
| 21 if len(argv) < 4: | |
| 22 print('usage: %s ignored inspector_html devtools_html' | |
| 23 ' css_and_js_files_list' % argv[0]) | |
| 24 return 1 | |
| 25 | |
| 26 # The first argument is ignored. We put 'webkit.gyp' in the inputs list | |
| 27 # for this script, so every time the list of script gets changed, our html | |
| 28 # file is rebuilt. | |
| 29 inspector_html_name = argv[2] | |
| 30 devtools_html_name = argv[3] | |
| 31 inspector_html = open(inspector_html_name, 'r') | |
| 32 devtools_html = open(devtools_html_name, 'w') | |
| 33 | |
| 34 for line in inspector_html: | |
| 35 if '</head>' in line: | |
| 36 devtools_html.write('\n <!-- The following lines are added to include D
evTools resources -->\n') | |
| 37 for resource in argv[4:]: | |
| 38 devtools_html.write(GenerateIncludeTag(resource)) | |
| 39 devtools_html.write(' <!-- End of auto-added files list -->\n') | |
| 40 devtools_html.write(line) | |
| 41 | |
| 42 devtools_html.close() | |
| 43 inspector_html.close() | |
| 44 | |
| 45 # Touch output file directory to make sure that Xcode will copy | |
| 46 # modified resource files. | |
| 47 if sys.platform == 'darwin': | |
| 48 output_dir_name = os.path.dirname(devtools_html_name) | |
| 49 os.utime(output_dir_name, None) | |
| 50 | |
| 51 if __name__ == '__main__': | |
| 52 sys.exit(main(sys.argv)) | |
| OLD | NEW |