File smart-1.1-python26.patch of Package smart

=== modified file 'smart/const.py'
--- smart/const.py	2008-10-09 19:41:53 +0000
+++ smart/const.py	2008-11-03 18:11:35 +0000
@@ -36,7 +36,8 @@
     def __new__(klass, name):
         instance = klass._registry.get(name)
         if not instance:
-            instance = klass._registry[name] = object.__new__(klass, name)
+            # "DeprecationWarning: object.__new__() takes no parameters"
+            instance = klass._registry[name] = object.__new__(klass)
         return instance
 
 INSTALL   = Enum("INSTALL")

=== modified file 'smart/cache.py'
--- smart/cache.py	2007-05-20 22:42:11 +0000
+++ smart/cache.py	2008-11-03 17:49:07 +0000
@@ -193,8 +193,11 @@
 
             filemd5 = self.getMD5(url)
             if filemd5:
-                import md5
-                digest = md5.md5()
+                try:
+                    from hashlib import md5
+                except ImportError:
+                    from md5 import md5
+                digest = md5()
                 file = open(localpath)
                 data = file.read(BLOCKSIZE)
                 while data:

=== modified file 'smart/control.py'
--- smart/control.py	2008-02-19 00:12:08 +0000
+++ smart/control.py	2008-11-03 18:12:34 +0000
@@ -37,7 +37,6 @@
 import sys, os
 import copy
 import time
-import md5
 
 class Control(object):
 

=== modified file 'smart/fetcher.py'
--- smart/fetcher.py	2008-10-06 20:02:20 +0000
+++ smart/fetcher.py	2008-11-03 17:46:53 +0000
@@ -367,8 +367,11 @@
 
             filemd5 = item.getInfo(uncompprefix+"md5")
             if filemd5:
-                import md5
-                digest = md5.md5()
+                try:
+                    from hashlib import md5
+                except ImportError:
+                    from md5 import md5
+                digest = md5()
                 file = open(localpath)
                 data = file.read(BLOCKSIZE)
                 while data:

=== modified file 'smart/plugins/aptchannelsync.py'
--- smart/plugins/aptchannelsync.py	2008-09-04 21:24:31 +0000
+++ smart/plugins/aptchannelsync.py	2008-11-03 17:51:20 +0000
@@ -20,7 +20,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 import posixpath
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 import os
 
 # be compatible with 2.3
@@ -69,7 +72,7 @@
             continue # We don't deal with these yet.
 
         # Build a unique alias.
-        m = md5.new("%s|%s|%s|%s" % (type, uri, distro, comps))
+        m = md5("%s|%s|%s|%s" % (type, uri, distro, comps))
         alias = "aptsync-%s" % m.hexdigest()
         seen.add(alias)
 

=== modified file 'smart/util/filetools.py'
--- smart/util/filetools.py	2008-06-29 20:50:22 +0000
+++ smart/util/filetools.py	2008-11-03 17:44:59 +0000
@@ -22,12 +22,15 @@
 from smart.const import BLOCKSIZE
 import resource
 import fcntl
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 import os
 
 def getFileDigest(path, digest=None):
     if not digest:
-        digest = md5.md5()
+        digest = md5()
     file = open(path)
     while True:
         data = file.read(BLOCKSIZE)
@@ -42,8 +45,8 @@
         return False
     if os.path.getsize(path1) != os.path.getsize(path2):
         return False
-    path1sum = md5.md5()
-    path2sum = md5.md5()
+    path1sum = md5()
+    path2sum = md5()
     for path, sum in [(path1, path1sum), (path2, path2sum)]:
         file = open(path)
         while True:

=== modified file 'smart/util/objdigest.py'
--- smart/util/objdigest.py	2004-11-04 23:34:52 +0000
+++ smart/util/objdigest.py	2008-11-03 17:45:33 +0000
@@ -20,7 +20,10 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 import cPickle
-import md5
+try:
+    from hashlib import md5
+except ImportError:
+    from md5 import md5
 
 def getObjectDigest(obj):
     return ObjectDigest(obj).getDigest()
@@ -31,7 +34,7 @@
 class ObjectDigest(object):
 
     def __init__(self, obj=None):
-        self._digest = md5.md5()
+        self._digest = md5()
         if obj:
             self.addObject(obj)
 

=== modified file 'smart/util/strtools.py'
--- smart/util/strtools.py	2007-11-03 06:35:46 +0000
+++ smart/util/strtools.py	2008-11-03 17:55:02 +0000
@@ -25,7 +25,6 @@
 
 import posixpath
 import string
-import md5
 import sys
 
 class ShortURL(object):

openSUSE Build Service is sponsored by