From: "Jan Beulich" Subject: Re: [patch] fix python 2.6 warnings Date: Tue, 10 Mar 2009 14:43:42 +0000 Message-ID: <49B68AAE.76E4.0078.0@novell.com> References: <49B64EC3.4070303@redhat.com> <18870.23173.605053.102901@mariner.uk.xensource.com> <49B66EB3.5010405@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <49B66EB3.5010405@redhat.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Jackson , Gerd Hoffmann Cc: Jim Fehlig , Xen Development Mailing List List-Id: xen-devel@lists.xenproject.org >>> Gerd Hoffmann 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 @@ #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D =20 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