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
)
54 print('Rebuilding %s because %s changed and %s was removed' % (
55 target
, newer
, removed
))
57 print('Rebuilding %s because %s changed' % (target
, newer
))
59 print('Rebuilding %s because %s was removed' % (
62 print('Rebuilding %s for an unknown reason' % target
)
65 if __name__
== '__main__':
67 rebuild_check(sys
.argv
[1:])