OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import pipes | 8 import pipes |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 15 matching lines...) Expand all Loading... | |
26 | 26 |
27 # TODO: Figure out how to merge this with pylib.cmd_helper.OutDirectory(). | 27 # TODO: Figure out how to merge this with pylib.cmd_helper.OutDirectory(). |
28 CHROME_OUT_DIR = os.path.join(CHROME_SRC, 'out') | 28 CHROME_OUT_DIR = os.path.join(CHROME_SRC, 'out') |
29 | 29 |
30 GOMA_DIR = os.environ.get('GOMA_DIR', os.path.join(BB_BUILD_DIR, 'goma')) | 30 GOMA_DIR = os.environ.get('GOMA_DIR', os.path.join(BB_BUILD_DIR, 'goma')) |
31 | 31 |
32 GSUTIL_PATH = os.path.join(BB_BUILD_DIR, 'third_party', 'gsutil', 'gsutil') | 32 GSUTIL_PATH = os.path.join(BB_BUILD_DIR, 'third_party', 'gsutil', 'gsutil') |
33 | 33 |
34 def CommandToString(command): | 34 def CommandToString(command): |
35 """Returns quoted command that can be run in bash shell.""" | 35 """Returns quoted command that can be run in bash shell.""" |
36 return ' '.join(map(pipes.quote, command)) | 36 return ' '.join(pipes.quote(c) for c in command) |
perezju
2015/09/04 09:01:53
maybe cmd_helper.SingleQuote?
jbudorick
2015/09/04 16:51:55
done
| |
37 | 37 |
38 | 38 |
39 def SpawnCmd(command, stdout=None, cwd=CHROME_SRC): | 39 def SpawnCmd(command, stdout=None, cwd=CHROME_SRC): |
40 """Spawn a process without waiting for termination.""" | 40 """Spawn a process without waiting for termination.""" |
41 print '>', CommandToString(command) | 41 print '>', CommandToString(command) |
42 sys.stdout.flush() | 42 sys.stdout.flush() |
43 if TESTING: | 43 if TESTING: |
44 class MockPopen(object): | 44 class MockPopen(object): |
45 @staticmethod | 45 @staticmethod |
46 def wait(): | 46 def wait(): |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 | 91 |
92 def RunSteps(steps, step_cmds, options): | 92 def RunSteps(steps, step_cmds, options): |
93 unknown_steps = set(steps) - set(step for step, _ in step_cmds) | 93 unknown_steps = set(steps) - set(step for step, _ in step_cmds) |
94 if unknown_steps: | 94 if unknown_steps: |
95 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps) | 95 print >> sys.stderr, 'FATAL: Unknown steps %s' % list(unknown_steps) |
96 sys.exit(1) | 96 sys.exit(1) |
97 | 97 |
98 for step, cmd in step_cmds: | 98 for step, cmd in step_cmds: |
99 if step in steps: | 99 if step in steps: |
100 cmd(options) | 100 cmd(options) |
OLD | NEW |