summaryrefslogtreecommitdiff
path: root/sysutils/xentools33/patches/patch-ff
blob: 9bd163209b48a840b7ae79496a6d99f806d1450e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
$NetBSD: patch-ff,v 1.1 2010/05/05 06:12:36 cegger Exp $

--- python/xen/util/acmpolicy.py.orig	2009-08-06 12:56:37.000000000 +0000
+++ python/xen/util/acmpolicy.py
@@ -17,12 +17,19 @@
 #============================================================================
 
 import os
-import sha
 import stat
 import array
 import struct
 import shutil
 import commands
+
+# sha is deprecated as of python 2.6
+try:
+    from hashlib import sha1
+except ImportError:
+    # but hashlib was only added in python 2.5
+    from sha import new as sha1
+
 from xml.dom import minidom, Node
 from xen.xend.XendLogging import log
 from xen.util import xsconstants, bootloader, mkdir
@@ -1102,8 +1109,8 @@ class ACMPolicy(XSPolicy):
         return None
 
     def hash(self):
-        """ Calculate a SAH1 hash of the XML policy """
-        return sha.sha(self.toxml())
+        """ Calculate a SHA1 hash of the XML policy """
+        return sha1(self.toxml())
 
     def save(self):
         ### Save the XML policy into a file ###