2013-09-26 17:14:40 +02:00

37 lines
1021 B
Plaintext

$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 ###