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 | |
newt (away)
2013/04/04 02:18:49
indent 2
cjhopman
2013/04/05 17:42:24
Done.
| |
107 # modified time and the modified time of the target. | |
newt (away)
2013/04/04 02:18:49
why?
newt (away)
2013/04/04 22:52:06
this can't hurt, but I can't think of a situation
cjhopman
2013/04/05 17:42:24
Why need symlink time:
The case that I think could
| |
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 input_time = max(map(GetModifiedTime, inputs)) | |
newt (away)
2013/04/04 02:18:49
functional programming FTW :)
in practice, if inp
cjhopman
2013/04/05 17:42:24
This works for me.
| |
117 | |
118 return output_time < input_time | |
OLD | NEW |