| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 os | 6 import os |
| 7 import subprocess | 7 import subprocess |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| 11 | 11 |
| 12 _HERE_PATH = os.path.join(os.path.dirname(__file__)) | 12 _HERE_PATH = os.path.join(os.path.dirname(__file__)) |
| 13 | 13 |
| 14 _HTML_IN_PATH = os.path.join(_HERE_PATH, 'downloads.html') | 14 _HTML_IN_PATH = os.path.join(_HERE_PATH, 'history.html') |
| 15 _HTML_OUT_PATH = os.path.join(_HERE_PATH, 'vulcanized.html') | 15 _HTML_OUT_PATH = os.path.join(_HERE_PATH, 'vulcanized.html') |
| 16 _JS_OUT_PATH = os.path.join(_HERE_PATH, 'crisper.js') | 16 _JS_OUT_PATH = os.path.join(_HERE_PATH, 'crisper.js') |
| 17 | 17 |
| 18 _SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..')) | 18 _SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..')) |
| 19 | 19 |
| 20 _RESOURCES_PATH = os.path.join(_SRC_PATH, 'ui', 'webui', 'resources') | 20 _RESOURCES_PATH = os.path.join(_SRC_PATH, 'ui', 'webui', 'resources') |
| 21 | 21 |
| 22 _CR_ELEMENTS_PATH = os.path.join(_RESOURCES_PATH, 'cr_elements') | 22 _CR_ELEMENTS_PATH = os.path.join(_RESOURCES_PATH, 'cr_elements') |
| 23 _CSS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'css') | 23 _CSS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'css') |
| 24 _HTML_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'html') | 24 _HTML_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'html') |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 # These files are dynamically created by C++. | 37 # These files are dynamically created by C++. |
| 38 '--exclude', 'load_time_data.js', | 38 '--exclude', 'load_time_data.js', |
| 39 '--exclude', 'strings.js', | 39 '--exclude', 'strings.js', |
| 40 '--exclude', 'text_defaults.css', | 40 '--exclude', 'text_defaults.css', |
| 41 '--exclude', 'text_defaults_md.css', | 41 '--exclude', 'text_defaults_md.css', |
| 42 | 42 |
| 43 '--inline-css', | 43 '--inline-css', |
| 44 '--inline-scripts', | 44 '--inline-scripts', |
| 45 | 45 |
| 46 '--redirect', 'chrome://downloads/|%s' % _HERE_PATH, | 46 '--redirect', 'chrome://history/|%s' % _HERE_PATH, |
| 47 '--redirect', 'chrome://resources/cr_elements/|%s' % _CR_ELEMENTS_PATH, | 47 '--redirect', 'chrome://resources/cr_elements/|%s' % _CR_ELEMENTS_PATH, |
| 48 '--redirect', 'chrome://resources/css/|%s' % _CSS_RESOURCES_PATH, | 48 '--redirect', 'chrome://resources/css/|%s' % _CSS_RESOURCES_PATH, |
| 49 '--redirect', 'chrome://resources/html/|%s' % _HTML_RESOURCES_PATH, | 49 '--redirect', 'chrome://resources/html/|%s' % _HTML_RESOURCES_PATH, |
| 50 '--redirect', 'chrome://resources/js/|%s' % _JS_RESOURCES_PATH, | 50 '--redirect', 'chrome://resources/js/|%s' % _JS_RESOURCES_PATH, |
| 51 '--redirect', 'chrome://resources/polymer/v1_0/|%s' % _POLYMER_PATH, | 51 '--redirect', 'chrome://resources/polymer/v1_0/|%s' % _POLYMER_PATH, |
| 52 | 52 |
| 53 '--strip-comments', | 53 '--strip-comments', |
| 54 ] | 54 ] |
| 55 | 55 |
| 56 def main(): | 56 def main(): |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 _run_cmd(['crisper', '--source', tmp.name, | 76 _run_cmd(['crisper', '--source', tmp.name, |
| 77 '--script-in-head', 'false', | 77 '--script-in-head', 'false', |
| 78 '--html', _HTML_OUT_PATH, | 78 '--html', _HTML_OUT_PATH, |
| 79 '--js', _JS_OUT_PATH]) | 79 '--js', _JS_OUT_PATH]) |
| 80 finally: | 80 finally: |
| 81 os.remove(tmp.name) | 81 os.remove(tmp.name) |
| 82 | 82 |
| 83 | 83 |
| 84 if __name__ == '__main__': | 84 if __name__ == '__main__': |
| 85 main() | 85 main() |
| OLD | NEW |