|
|
|
|
|
|
|
|
|
|
xen-devel
Re: [Xen-devel] [patch] fix python 2.6 warnings
Jan Beulich schrieb:
Gerd Hoffmann <kraxel@xxxxxxxxxx> 10.03.09 14:44 >>>
Which makes me think at least the hashlib one needs a more sophisticated
approach so it keeps working on pre-2.5 versions ...
Something like this (I had hoped this would have been submitted long ago,
but apparently it wasn't even attempted).
Jan
--- xen-3.3.1-testing.orig/tools/python/xen/util/acmpolicy.py
+++ xen-3.3.1-testing/tools/python/xen/util/acmpolicy.py
@@ -17,7 +17,10 @@
#============================================================================
import os
-import sha
+try:
+ import hashlib # python v2.6 or newer
+except ImportError:
+ import sha # python v2.5 or older
import stat
import array
import struct
hello,
this might work better
-import sha
+try:
+ import sha1 from hashlib # python v2.5 or newer
+except ImportError:
+ import sha as sha1 # pre python v2.5
and call it with: sha1( foo )
Marc
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
|
|
|
|