OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import hashlib | 6 import hashlib |
7 import os | 7 import os |
8 import string | 8 import string |
9 import sys | 9 import sys |
10 | 10 |
11 # usage: | 11 # usage: |
(...skipping 15 matching lines...) Expand all Loading... |
27 h.update(f.read()) | 27 h.update(f.read()) |
28 filehash = h.hexdigest() | 28 filehash = h.hexdigest() |
29 f.close() | 29 f.close() |
30 print filehash.lower() + " *" + os.path.basename(filename) | 30 print filehash.lower() + " *" + os.path.basename(filename) |
31 except IOError: | 31 except IOError: |
32 sys.stderr.write("sha1sum.py unable to open file %s\n" % filename) | 32 sys.stderr.write("sha1sum.py unable to open file %s\n" % filename) |
33 sys.exit(-1) | 33 sys.exit(-1) |
34 | 34 |
35 # all files hashed with success | 35 # all files hashed with success |
36 sys.exit(0) | 36 sys.exit(0) |
OLD | NEW |