SOURCES: pynapi.py - work with pre-hashlib pythons, too

arekm arekm at pld-linux.org
Fri Feb 6 21:51:50 CET 2009


Author: arekm                        Date: Fri Feb  6 20:51:50 2009 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- work with pre-hashlib pythons, too

---- Files affected:
SOURCES:
   pynapi.py (1.15 -> 1.16) 

---- Diffs:

================================================================
Index: SOURCES/pynapi.py
diff -u SOURCES/pynapi.py:1.15 SOURCES/pynapi.py:1.16
--- SOURCES/pynapi.py:1.15	Fri Feb  6 21:43:13 2009
+++ SOURCES/pynapi.py	Fri Feb  6 21:51:44 2009
@@ -18,7 +18,6 @@
 # 
 
 
-import hashlib
 import sys
 import urllib
 import subprocess
@@ -26,6 +25,11 @@
 import os
 import getopt
 
+try:
+    from hashlib import md5 as md5
+except ImportError:
+    from md5 import md5
+
 napipass = 'iBlm8NTigvru0Jr0'
 
 prog = os.path.basename(sys.argv[0])
@@ -111,7 +115,7 @@
 
     print >> sys.stderr, "%s: %d/%d: Processing subtitle for %s" % (prog, i, i_total, file)
 
-    d = hashlib.md5()
+    d = md5()
     try:
         d.update(open(file).read(10485760))
     except (IOError, OSError), e:
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/pynapi.py?r1=1.15&r2=1.16&f=u



More information about the pld-cvs-commit mailing list