| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp: | 161 with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp: |
| 162 tmp.write(output) | 162 tmp.write(output) |
| 163 | 163 |
| 164 try: | 164 try: |
| 165 node.RunNode([node_modules.PathToCrisper(), | 165 node.RunNode([node_modules.PathToCrisper(), |
| 166 '--source', tmp.name, | 166 '--source', tmp.name, |
| 167 '--script-in-head', 'false', | 167 '--script-in-head', 'false', |
| 168 '--html', html_out_path, | 168 '--html', html_out_path, |
| 169 '--js', js_out_path]) | 169 '--js', js_out_path]) |
| 170 | 170 |
| 171 # Create an empty JS file if crisper did not create one. |
| 172 if not os.path.isfile(js_out_path): |
| 173 open(js_out_path, 'w').close() |
| 174 |
| 171 node.RunNode([node_modules.PathToUglifyJs(), js_out_path, | 175 node.RunNode([node_modules.PathToUglifyJs(), js_out_path, |
| 172 '--comments', '"/Copyright|license|LICENSE|\<\/?if/"', | 176 '--comments', '"/Copyright|license|LICENSE|\<\/?if/"', |
| 173 '--output', js_out_path]) | 177 '--output', js_out_path]) |
| 174 finally: | 178 finally: |
| 175 os.remove(tmp.name) | 179 os.remove(tmp.name) |
| 176 | 180 |
| 177 | 181 |
| 178 def main(argv): | 182 def main(argv): |
| 179 parser = argparse.ArgumentParser() | 183 parser = argparse.ArgumentParser() |
| 180 parser.add_argument('--depfile', required=True) | 184 parser.add_argument('--depfile', required=True) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 194 args.depfile = os.path.normpath(args.depfile) | 198 args.depfile = os.path.normpath(args.depfile) |
| 195 args.input = os.path.normpath(args.input) | 199 args.input = os.path.normpath(args.input) |
| 196 args.out_folder = os.path.normpath(args.out_folder) | 200 args.out_folder = os.path.normpath(args.out_folder) |
| 197 | 201 |
| 198 _vulcanize(args.input, args) | 202 _vulcanize(args.input, args) |
| 199 _update_dep_file(args.input, args) | 203 _update_dep_file(args.input, args) |
| 200 | 204 |
| 201 | 205 |
| 202 if __name__ == '__main__': | 206 if __name__ == '__main__': |
| 203 main(sys.argv[1:]) | 207 main(sys.argv[1:]) |
| OLD | NEW |