Commit 29c4ba7e authored by dbeam's avatar dbeam Committed by Commit bot

MD WebUI: fix vulcanize.py for Windows

R=dpapad@chromium.org
BUG=673825
NOTRY=true
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2594763002
Cr-Commit-Position: refs/heads/master@{#439864}
parent 6c2c67d5
...@@ -39,17 +39,17 @@ _VULCANIZE_BASE_ARGS = [ ...@@ -39,17 +39,17 @@ _VULCANIZE_BASE_ARGS = [
'--inline-css', '--inline-css',
'--inline-scripts', '--inline-scripts',
'--redirect', 'chrome://resources/cr_elements/|%s' % _CR_ELEMENTS_PATH, '--redirect', '"chrome://resources/cr_elements/|%s"' % _CR_ELEMENTS_PATH,
'--redirect', 'chrome://resources/css/|%s' % _CSS_RESOURCES_PATH, '--redirect', '"chrome://resources/css/|%s"' % _CSS_RESOURCES_PATH,
'--redirect', 'chrome://resources/html/|%s' % _HTML_RESOURCES_PATH, '--redirect', '"chrome://resources/html/|%s"' % _HTML_RESOURCES_PATH,
'--redirect', 'chrome://resources/js/|%s' % _JS_RESOURCES_PATH, '--redirect', '"chrome://resources/js/|%s"' % _JS_RESOURCES_PATH,
'--redirect', 'chrome://resources/polymer/v1_0/|%s' % _POLYMER_PATH, '--redirect', '"chrome://resources/polymer/v1_0/|%s"' % _POLYMER_PATH,
'--strip-comments', '--strip-comments',
] ]
def _run_cmd(cmd_parts, stdout=None): def _run_cmd(cmd_parts, stdout=None):
cmd = "'" + "' '".join(cmd_parts) + "'" cmd = " ".join(cmd_parts)
process = subprocess.Popen( process = subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
stdout, stderr = process.communicate() stdout, stderr = process.communicate()
...@@ -71,7 +71,7 @@ def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html', ...@@ -71,7 +71,7 @@ def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html',
extra_args = extra_args or [] extra_args = extra_args or []
output = _run_cmd(['vulcanize'] + _VULCANIZE_BASE_ARGS + extra_args + output = _run_cmd(['vulcanize'] + _VULCANIZE_BASE_ARGS + extra_args +
['--redirect', 'chrome://%s/|%s' % (host, target_path), ['--redirect', '"chrome://%s/|%s"' % (host, target_path),
html_in_path]) html_in_path])
with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp: with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp:
...@@ -88,7 +88,7 @@ def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html', ...@@ -88,7 +88,7 @@ def _vulcanize(directory, host, html_in_file, html_out_file='vulcanized.html',
# TODO(tsergeant): Remove when JS resources are minified by default: # TODO(tsergeant): Remove when JS resources are minified by default:
# crbug.com/619091. # crbug.com/619091.
_run_cmd(['uglifyjs', js_out_path, _run_cmd(['uglifyjs', js_out_path,
'--comments', '/Copyright|license|LICENSE|\<\/?if/', '--comments', '"/Copyright|license|LICENSE|\<\/?if/"',
'--output', js_out_path]) '--output', js_out_path])
finally: finally:
os.remove(tmp.name) os.remove(tmp.name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment