]> git.samba.org - samba.git/commitdiff
build: cope with systems that don't have md5 in python
authorAndrew Tridgell <tridge@samba.org>
Wed, 24 Mar 2010 05:37:41 +0000 (16:37 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:05 +0000 (20:27 +1000)
buildtools/wafsamba/samba_utils.py

index 59003d8212632f0c1670d8df9f4e1fc64af79b9e..b1e62f1fce3ba04ac60b1c84b9ea9cb613367a74 100644 (file)
@@ -341,3 +341,24 @@ def RUN_COMMAND(cmd,
         return - os.WTERMSIG(status)
     print "Unknown exit reason %d for command: %s" (status, cmd)
     return -1
+
+
+# make sure we have md5. some systems don't have it
+try:
+    from hashlib import md5
+except:
+    try:
+        import md5
+    except:
+        import Constants
+        Constants.SIG_NIL = hash('abcd')
+        class replace_md5(object):
+            def __init__(self):
+                self.val = None
+            def update(self, val):
+                self.val = hash((self.val, val))
+            def digest(self):
+                return str(self.val)
+            def hexdigest(self):
+                return self.digest().encode('hex')
+        Utils.md5 = replace_md5