get_tool_mtime.py 653 B

12345678910111213141516171819
  1. # Copyright 2016 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. from __future__ import print_function
  5. import os
  6. import sys
  7. # Usage: python get_tool_mtime.py path/to/file1.py path/to/file2.py
  8. #
  9. # Prints a GN scope with the variable name being the basename sans-extension
  10. # and the value being the file modification time. A variable is emitted for
  11. # each file argument on the command line.
  12. if __name__ == '__main__':
  13. for f in sys.argv[1:]:
  14. variable = os.path.splitext(os.path.basename(f))[0]
  15. print('%s = %d' % (variable, os.path.getmtime(f)))