Mercurial > hg-stable
comparison tests/md5sum.py @ 32870:3a64ac39b893
md5sum: adapt for python 3 support
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 15 Jun 2017 12:49:13 -0400 |
parents | 8d1cdee372e6 |
children | 904bc1dc2694 |
comparison
equal
deleted
inserted
replaced
32869:cb6436e051ca | 32870:3a64ac39b893 |
---|---|
32 sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) | 32 sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) |
33 sys.exit(1) | 33 sys.exit(1) |
34 | 34 |
35 m = md5() | 35 m = md5() |
36 try: | 36 try: |
37 for data in iter(lambda: fp.read(8192), ''): | 37 for data in iter(lambda: fp.read(8192), b''): |
38 m.update(data) | 38 m.update(data) |
39 except IOError as msg: | 39 except IOError as msg: |
40 sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) | 40 sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) |
41 sys.exit(1) | 41 sys.exit(1) |
42 sys.stdout.write('%s %s\n' % (m.hexdigest(), filename)) | 42 sys.stdout.write('%s %s\n' % (m.hexdigest(), filename)) |