| 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 ast | 5 import ast |
| 6 import contextlib | 6 import contextlib |
| 7 import fnmatch | 7 import fnmatch |
| 8 import json | 8 import json |
| 9 import os | 9 import os |
| 10 import pipes | 10 import pipes |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 # TODO(agrieve): Get rid of this once we've moved to argparse. | 417 # TODO(agrieve): Get rid of this once we've moved to argparse. |
| 418 if hasattr(parser, 'add_option'): | 418 if hasattr(parser, 'add_option'): |
| 419 func = parser.add_option | 419 func = parser.add_option |
| 420 else: | 420 else: |
| 421 func = parser.add_argument | 421 func = parser.add_argument |
| 422 func('--depfile', | 422 func('--depfile', |
| 423 help='Path to depfile. Must be specified as the action\'s first output.') | 423 help='Path to depfile. Must be specified as the action\'s first output.') |
| 424 | 424 |
| 425 | 425 |
| 426 def WriteDepfile(path, dependencies): | 426 def WriteDepfile(path, dependencies): |
| 427 MakeDirectory(os.path.dirname(path)) |
| 427 with open(path, 'w') as depfile: | 428 with open(path, 'w') as depfile: |
| 428 depfile.write(path) | 429 depfile.write(path) |
| 429 depfile.write(': ') | 430 depfile.write(': ') |
| 430 depfile.write(' '.join(dependencies)) | 431 depfile.write(' '.join(dependencies)) |
| 431 depfile.write('\n') | 432 depfile.write('\n') |
| 432 | 433 |
| 433 | 434 |
| 434 def ExpandFileArgs(args): | 435 def ExpandFileArgs(args): |
| 435 """Replaces file-arg placeholders in args. | 436 """Replaces file-arg placeholders in args. |
| 436 | 437 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 530 |
| 530 md5_check.CallAndRecordIfStale( | 531 md5_check.CallAndRecordIfStale( |
| 531 on_stale_md5, | 532 on_stale_md5, |
| 532 record_path=record_path, | 533 record_path=record_path, |
| 533 input_paths=input_paths, | 534 input_paths=input_paths, |
| 534 input_strings=input_strings, | 535 input_strings=input_strings, |
| 535 output_paths=output_paths, | 536 output_paths=output_paths, |
| 536 force=force, | 537 force=force, |
| 537 pass_changes=True) | 538 pass_changes=True) |
| 538 | 539 |
| OLD | NEW |