SVN: ZODB/trunk/src/ZODB/scripts/repozo.py Reverted 105914, 105920, and the part of 105889 that changes imports

Jim Fulton <[email protected]>
Newsgroups gmane.comp.python.zope.zodb.cvs
Message-ID <20091201211218.9C1CF9415B__5556.11750246516$1259701951$gmane$org@cvs.zope.org>
Log message for revision 106146:
  Reverted 105914, 105920, and the part of 105889 that changes imports
  of md5 support to avoid a deprecation warning.  I would love to
  reapply 105888 (from the 3.9 branch) when there is an adequate test.
  This can be achived through a pretty straightforward conversion of the
  existing manual repozo test to an automated test.
  

Changed:
  U   ZODB/trunk/src/ZODB/scripts/repozo.py

-=-
Modified: ZODB/trunk/src/ZODB/scripts/repozo.py
===================================================================
--- ZODB/trunk/src/ZODB/scripts/repozo.py	2009-12-01 21:02:19 UTC (rev 106145)
+++ ZODB/trunk/src/ZODB/scripts/repozo.py	2009-12-01 21:12:18 UTC (rev 106146)
@@ -65,6 +65,7 @@
 
 import os
 import sys
+import md5
 import gzip
 import time
 import errno
@@ -81,12 +82,6 @@
 READCHUNK = 16 * 1024
 VERBOSE = False
 
-if sys.version_info[1]>4:
-    # the hashlib package is available from Python 2.5
-    from hashlib import md5
-else:
-    # the md5 package is deprecated in Python 2.6
-    from md5 import new as md5
 
 def usage(code, msg=''):
     outfp = sys.stderr
@@ -215,7 +210,7 @@
 
 def checksum(fp, n):
     # Checksum the first n bytes of the specified file
-    sum = md5()
+    sum = md5.new()
     def func(data):
         sum.update(data)
     dofile(func, fp, n)
@@ -226,7 +221,7 @@
     # Copy bytes from file src, to file dst, starting at offset start, for n
     # length of bytes.  For robustness, we first write, flush and fsync
     # to a temp file, then rename the temp file at the end.
-    sum = md5()
+    sum = md5.new()
     ifp = open(options.file, 'rb')
     ifp.seek(start)
     tempname = os.path.join(os.path.dirname(dst), 'tmp.tmp')
@@ -253,7 +248,7 @@
     # Concatenate a bunch of files from the repository, output to `outfile' if
     # given.  Return the number of bytes written and the md5 checksum of the
     # bytes.
-    sum = md5()
+    sum = md5.new()
     def func(data):
         sum.update(data)
         if ofp:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.