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/.
5 from __future__
import absolute_import
, print_function
, unicode_literals
12 return os
.stat(path
).st_mtime
14 if e
.errno
== errno
.ENOENT
:
19 def rebuild_check(args
):
36 def format_filelist(filelist
):
41 length
= len(filelist
)
43 return ", ".join(filelist
)
45 truncated
= filelist
[:limit
]
46 remaining
= length
- limit
48 return "%s (and %d other files)" % (", ".join(truncated
), remaining
)
50 newer
= format_filelist(newer
)
51 removed
= format_filelist(removed
)
55 "Rebuilding %s because %s changed and %s was removed"
56 % (target
, newer
, removed
)
59 print("Rebuilding %s because %s changed" % (target
, newer
))
61 print("Rebuilding %s because %s was removed" % (target
, removed
))
63 print("Rebuilding %s for an unknown reason" % target
)
66 if __name__
== "__main__":
69 rebuild_check(sys
.argv
[1:])