Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 Google Inc. 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 copy | 5 import copy |
| 6 import ntpath | 6 import ntpath |
| 7 import os | 7 import os |
| 8 import posixpath | 8 import posixpath |
| 9 import re | 9 import re |
| 10 import subprocess | 10 import subprocess |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 288 cmd = cmd % {'cygwin_dir': cygwin_dir, | 288 cmd = cmd % {'cygwin_dir': cygwin_dir, |
| 289 'cmd': direct_cmd} | 289 'cmd': direct_cmd} |
| 290 return input_dir_preamble + cmd | 290 return input_dir_preamble + cmd |
| 291 else: | 291 else: |
| 292 # Convert cat --> type to mimic unix. | 292 # Convert cat --> type to mimic unix. |
| 293 if cmd[0] == 'cat': | 293 if cmd[0] == 'cat': |
| 294 command = ['type'] | 294 command = ['type'] |
| 295 else: | 295 else: |
| 296 command = [cmd[0].replace('/', '\\')] | 296 command = [cmd[0].replace('/', '\\')] |
| 297 # Fix the paths | 297 # Fix the paths |
| 298 # If the argument starts with a slash, it's probably a command line switch | 298 # TODO(quote): This is a really ugly heuristic, and will miss path fixing |
| 299 arguments = [i.startswith('/') and i or _FixPath(i) for i in cmd[1:]] | 299 # for arguments like "--arg=path" or "/opt:path". |
| 300 # If the argument starts with a slash or dash, it's probably a command line | |
| 301 # switch | |
| 302 arguments = [i if (i[:1] in "/-") else _FixPath(i) for i in cmd[1:]] | |
|
scottmg
2012/07/27 00:31:49
i[0] instead of i[:1]
| |
| 300 arguments = [i.replace('$(InputDir)','%INPUTDIR%') for i in arguments] | 303 arguments = [i.replace('$(InputDir)','%INPUTDIR%') for i in arguments] |
| 301 if quote_cmd: | 304 if quote_cmd: |
| 302 # Support a mode for using cmd directly. | 305 # Support a mode for using cmd directly. |
| 303 # Convert any paths to native form (first element is used directly). | 306 # Convert any paths to native form (first element is used directly). |
| 304 # TODO(quote): regularize quoting path names throughout the module | 307 # TODO(quote): regularize quoting path names throughout the module |
| 305 arguments = ['"%s"' % i for i in arguments] | 308 arguments = ['"%s"' % i for i in arguments] |
| 306 # Collapse into a single command. | 309 # Collapse into a single command. |
| 307 return input_dir_preamble + ' '.join(command + arguments) | 310 return input_dir_preamble + ' '.join(command + arguments) |
| 308 | 311 |
| 309 | 312 |
| (...skipping 2803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3113 action_spec.extend( | 3116 action_spec.extend( |
| 3114 # TODO(jeanluc) 'Document' for all or just if as_sources? | 3117 # TODO(jeanluc) 'Document' for all or just if as_sources? |
| 3115 [['FileType', 'Document'], | 3118 [['FileType', 'Document'], |
| 3116 ['Command', command], | 3119 ['Command', command], |
| 3117 ['Message', description], | 3120 ['Message', description], |
| 3118 ['Outputs', outputs] | 3121 ['Outputs', outputs] |
| 3119 ]) | 3122 ]) |
| 3120 if additional_inputs: | 3123 if additional_inputs: |
| 3121 action_spec.append(['AdditionalInputs', additional_inputs]) | 3124 action_spec.append(['AdditionalInputs', additional_inputs]) |
| 3122 actions_spec.append(action_spec) | 3125 actions_spec.append(action_spec) |
| OLD | NEW |