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 fnmatch | 5 import fnmatch |
6 import json | 6 import json |
7 import os | 7 import os |
8 import pipes | 8 import pipes |
9 import shlex | 9 import shlex |
10 import shutil | 10 import shutil |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 print stdout, | 94 print stdout, |
95 | 95 |
96 # Directly exit to avoid printing stacktrace. | 96 # Directly exit to avoid printing stacktrace. |
97 sys.exit(child.returncode) | 97 sys.exit(child.returncode) |
98 | 98 |
99 else: | 99 else: |
100 if stdout and not suppress_output: | 100 if stdout and not suppress_output: |
101 print stdout, | 101 print stdout, |
102 return stdout | 102 return stdout |
103 | 103 |
| 104 |
| 105 def GetModifiedTime(path): |
| 106 # For a symlink, the modified time should be the greater of the link's |
| 107 # modified time and the modified time of the target. |
| 108 return max(os.lstat(path).st_mtime, os.stat(path).st_mtime) |
| 109 |
| 110 |
| 111 def IsTimeStale(output, inputs): |
| 112 if not os.path.exists(output): |
| 113 return True |
| 114 |
| 115 output_time = GetModifiedTime(output) |
| 116 for input in inputs: |
| 117 if GetModifiedTime(input) > output_time: |
| 118 return True |
| 119 return False |
OLD | NEW |