OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (C) 2010 Google Inc. All rights reserved. | 3 # Copyright (C) 2010 Google Inc. All rights reserved. |
4 # | 4 # |
5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
7 # met: | 7 # met: |
8 # | 8 # |
9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
(...skipping 26 matching lines...) Expand all Loading... |
37 (dir_name, file_name) = os.path.split(resource_path) | 37 (dir_name, file_name) = os.path.split(resource_path) |
38 if (file_name.endswith('.js')): | 38 if (file_name.endswith('.js')): |
39 return ' <script type="text/javascript" src="%s"></script>\n' % file_
name | 39 return ' <script type="text/javascript" src="%s"></script>\n' % file_
name |
40 elif (file_name.endswith('.css')): | 40 elif (file_name.endswith('.css')): |
41 return ' <link rel="stylesheet" type="text/css" href="%s">\n' % file_
name | 41 return ' <link rel="stylesheet" type="text/css" href="%s">\n' % file_
name |
42 else: | 42 else: |
43 assert resource_path | 43 assert resource_path |
44 | 44 |
45 | 45 |
46 def write_devtools_html(inspector_file, devtools_file, debug): | 46 def write_devtools_html(inspector_file, devtools_file, debug): |
47 buildsystemonly_js_written = False | |
48 | |
49 for line in inspector_file: | 47 for line in inspector_file: |
50 if not debug: | 48 if not debug: |
51 if '<script ' in line or '<link ' in line: | 49 if '<script ' in line or '<link ' in line: |
52 continue | 50 continue |
53 if '</head>' in line: | 51 if '</head>' in line: |
54 devtools_file.write(generate_include_tag("inspector.css")) | 52 devtools_file.write(generate_include_tag("inspector.css")) |
55 devtools_file.write(generate_include_tag("buildSystemOnly.js")) | |
56 devtools_file.write(generate_include_tag("Main.js")) | 53 devtools_file.write(generate_include_tag("Main.js")) |
57 else: | |
58 if not buildsystemonly_js_written and '<script ' in line: | |
59 devtools_file.write(generate_include_tag("buildSystemOnly.js")) | |
60 buildsystemonly_js_written = True | |
61 devtools_file.write(line) | 54 devtools_file.write(line) |
62 | 55 |
63 | 56 |
64 def main(argv): | 57 def main(argv): |
65 | 58 |
66 if len(argv) < 4: | 59 if len(argv) < 4: |
67 print('usage: %s inspector_html devtools_html debug' % argv[0]) | 60 print('usage: %s inspector_html devtools_html debug' % argv[0]) |
68 return 1 | 61 return 1 |
69 | 62 |
70 # The first argument is ignored. We put 'web.gyp' in the inputs list | 63 # The first argument is ignored. We put 'web.gyp' in the inputs list |
(...skipping 11 matching lines...) Expand all Loading... |
82 inspector_html.close() | 75 inspector_html.close() |
83 | 76 |
84 # Touch output file directory to make sure that Xcode will copy | 77 # Touch output file directory to make sure that Xcode will copy |
85 # modified resource files. | 78 # modified resource files. |
86 if sys.platform == 'darwin': | 79 if sys.platform == 'darwin': |
87 output_dir_name = os.path.dirname(devtools_html_name) | 80 output_dir_name = os.path.dirname(devtools_html_name) |
88 os.utime(output_dir_name, None) | 81 os.utime(output_dir_name, None) |
89 | 82 |
90 if __name__ == '__main__': | 83 if __name__ == '__main__': |
91 sys.exit(main(sys.argv)) | 84 sys.exit(main(sys.argv)) |
OLD | NEW |