add md5sum.py required by fix in previous changeset
authorPeter van Dijk <peter@dataloss.nl>
Tue, 21 Feb 2006 22:32:17 +0100
changeset 1924 46fb38ef9a91
parent 1923 7d83a351a936
child 1925 c71420b186b0
add md5sum.py required by fix in previous changeset
tests/md5sum.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/md5sum.py	Tue Feb 21 22:32:17 2006 +0100
@@ -0,0 +1,25 @@
+#! /usr/bin/env python
+import sys
+import os
+import md5
+
+for filename in sys.argv[1:]:
+    try:
+        fp = open(filename, 'rb')
+    except IOError, msg:
+        sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg))
+        sys.exit(1)
+    
+    m = md5.new()
+    try:
+        while 1:
+            data = fp.read(8192)
+            if not data:
+                break
+            m.update(data)
+    except IOError, msg:
+        sys.stderr.write('%s: I/O error: %s\n' % (filename, msg))
+        sys.exit(1)
+    sys.stdout.write('%s  %s\n' % (m.hexdigest(), filename))
+
+sys.exit(0)