| 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 """ | 492 """ |
| 493 if not output_paths: | 493 if not output_paths: |
| 494 raise Exception('At least one output_path must be specified.') | 494 raise Exception('At least one output_path must be specified.') |
| 495 input_paths = list(input_paths or []) | 495 input_paths = list(input_paths or []) |
| 496 input_strings = list(input_strings or []) | 496 input_strings = list(input_strings or []) |
| 497 output_paths = list(output_paths or []) | 497 output_paths = list(output_paths or []) |
| 498 | 498 |
| 499 python_deps = None | 499 python_deps = None |
| 500 if hasattr(options, 'depfile') and options.depfile: | 500 if hasattr(options, 'depfile') and options.depfile: |
| 501 python_deps = GetPythonDependencies() | 501 python_deps = GetPythonDependencies() |
| 502 # List python deps in input_strings rather than input_paths since the | 502 input_paths += python_deps |
| 503 # contents of them does not change what gets written to the depfile. | |
| 504 input_strings += python_deps | |
| 505 output_paths += [options.depfile] | 503 output_paths += [options.depfile] |
| 506 | 504 |
| 507 stamp_file = hasattr(options, 'stamp') and options.stamp | 505 stamp_file = hasattr(options, 'stamp') and options.stamp |
| 508 if stamp_file: | 506 if stamp_file: |
| 509 output_paths += [stamp_file] | 507 output_paths += [stamp_file] |
| 510 | 508 |
| 511 def on_stale_md5(changes): | 509 def on_stale_md5(changes): |
| 512 args = (changes,) if pass_changes else () | 510 args = (changes,) if pass_changes else () |
| 513 function(*args) | 511 function(*args) |
| 514 if python_deps is not None: | 512 if python_deps is not None: |
| 515 all_depfile_deps = list(python_deps) | 513 all_depfile_deps = list(python_deps) |
| 516 if depfile_deps: | 514 if depfile_deps: |
| 517 all_depfile_deps.extend(depfile_deps) | 515 all_depfile_deps.extend(depfile_deps) |
| 518 WriteDepfile(options.depfile, all_depfile_deps) | 516 WriteDepfile(options.depfile, all_depfile_deps) |
| 519 if stamp_file: | 517 if stamp_file: |
| 520 Touch(stamp_file) | 518 Touch(stamp_file) |
| 521 | 519 |
| 522 md5_check.CallAndRecordIfStale( | 520 md5_check.CallAndRecordIfStale( |
| 523 on_stale_md5, | 521 on_stale_md5, |
| 524 record_path=record_path, | 522 record_path=record_path, |
| 525 input_paths=input_paths, | 523 input_paths=input_paths, |
| 526 input_strings=input_strings, | 524 input_strings=input_strings, |
| 527 output_paths=output_paths, | 525 output_paths=output_paths, |
| 528 force=force, | 526 force=force, |
| 529 pass_changes=True) | 527 pass_changes=True) |
| 530 | 528 |
| OLD | NEW |