##// END OF EJS Templates
md5sum: assume hashlib exists now that we're 2.7 only
Augie Fackler -
r33875:904bc1dc default
parent child Browse files
Show More
@@ -8,17 +8,11 b''
8
8
9 from __future__ import absolute_import
9 from __future__ import absolute_import
10
10
11 import hashlib
11 import os
12 import os
12 import sys
13 import sys
13
14
14 try:
15 try:
15 import hashlib
16 md5 = hashlib.md5
17 except ImportError:
18 import md5
19 md5 = md5.md5
20
21 try:
22 import msvcrt
16 import msvcrt
23 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
17 msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
24 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
18 msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
@@ -32,7 +26,7 b' for filename in sys.argv[1:]:'
32 sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
26 sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
33 sys.exit(1)
27 sys.exit(1)
34
28
35 m = md5()
29 m = hashlib.md5()
36 try:
30 try:
37 for data in iter(lambda: fp.read(8192), b''):
31 for data in iter(lambda: fp.read(8192), b''):
38 m.update(data)
32 m.update(data)
General Comments 0
You need to be logged in to leave comments. Login now