OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 import argparse | 6 import argparse |
7 import itertools | 7 import itertools |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import re | 10 import re |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 with open(html_out_path, 'r+') as f: | 181 with open(html_out_path, 'r+') as f: |
182 data = f.read() | 182 data = f.read() |
183 new_data = data.replace( | 183 new_data = data.replace( |
184 '</body></html>', | 184 '</body></html>', |
185 '<script src="' + args.js_out_file + '"></script></body></html>') | 185 '<script src="' + args.js_out_file + '"></script></body></html>') |
186 assert new_data != data, 'Expected to find </body></html> token.' | 186 assert new_data != data, 'Expected to find </body></html> token.' |
187 f.seek(0) | 187 f.seek(0) |
188 f.write(new_data) | 188 f.write(new_data) |
189 f.truncate() | 189 f.truncate() |
190 | 190 |
191 node.RunNode([node_modules.PathToUglifyJs(), crisper_output.name, | 191 node.RunNode([node_modules.PathToUglify(), crisper_output.name, |
192 '--comments', '"/Copyright|license|LICENSE|\<\/?if/"', | 192 '--comments', '"/Copyright|license|LICENSE|\<\/?if/"', |
193 '--output', js_out_path]) | 193 '--output', js_out_path]) |
194 finally: | 194 finally: |
195 if os.path.exists(crisper_input.name): | 195 if os.path.exists(crisper_input.name): |
196 os.remove(crisper_input.name) | 196 os.remove(crisper_input.name) |
197 if os.path.exists(crisper_output.name): | 197 if os.path.exists(crisper_output.name): |
198 os.remove(crisper_output.name) | 198 os.remove(crisper_output.name) |
199 | 199 |
200 | 200 |
201 def main(argv): | 201 def main(argv): |
(...skipping 15 matching lines...) Expand all Loading... |
217 args.depfile = os.path.normpath(args.depfile) | 217 args.depfile = os.path.normpath(args.depfile) |
218 args.input = os.path.normpath(args.input) | 218 args.input = os.path.normpath(args.input) |
219 args.out_folder = os.path.normpath(args.out_folder) | 219 args.out_folder = os.path.normpath(args.out_folder) |
220 | 220 |
221 _vulcanize(args.input, args) | 221 _vulcanize(args.input, args) |
222 _update_dep_file(args.input, args) | 222 _update_dep_file(args.input, args) |
223 | 223 |
224 | 224 |
225 if __name__ == '__main__': | 225 if __name__ == '__main__': |
226 main(sys.argv[1:]) | 226 main(sys.argv[1:]) |
OLD | NEW |