1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 return os
.stat(path
).st_mtime
13 if e
.errno
== errno
.ENOENT
:
18 def rebuild_check(args
):
35 def format_filelist(filelist
):
40 length
= len(filelist
)
42 return ", ".join(filelist
)
44 truncated
= filelist
[:limit
]
45 remaining
= length
- limit
47 return "%s (and %d other files)" % (", ".join(truncated
), remaining
)
49 newer
= format_filelist(newer
)
50 removed
= format_filelist(removed
)
54 "Rebuilding %s because %s changed and %s was removed"
55 % (target
, newer
, removed
)
58 print("Rebuilding %s because %s changed" % (target
, newer
))
60 print("Rebuilding %s because %s was removed" % (target
, removed
))
62 print("Rebuilding %s for an unknown reason" % target
)
65 if __name__
== "__main__":
68 rebuild_check(sys
.argv
[1:])