Hi, Attached patch fixes a few python warnings about deprecated modules. cheers, Gerd _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Gerd Hoffmann wrote:> Hi, > > Attached patch fixes a few python warnings about deprecated modules.Oops, that one had a tyops, fixed version attached. cheers, Gerd _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Gerd Hoffmann writes ("[Xen-devel] [patch] fix python 2.6 warnings"):> Attached patch fixes a few python warnings about deprecated modules.Can you please confirm in which Python version the new modules were introduced ? Some people (including our automatic test systems!) are using very old versions of python and it would be nice if that kept working. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, 10 Mar 2009, Gerd Hoffmann wrote:> Attached patch fixes a few python warnings about deprecated modules.Do you mean ''slasses''? My knowledge of python isn''t great, but that looks like a typo. Michael Young _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson wrote:> Gerd Hoffmann writes ("[Xen-devel] [patch] fix python 2.6 warnings"): >> Attached patch fixes a few python warnings about deprecated modules. > > Can you please confirm in which Python version the new modules were > introduced ? Some people (including our automatic test systems!) are > using very old versions of python and it would be nice if that kept > working.set type (obsoletes sets module) was added in 2.4 hashlib (obsoletes sha module) was added in 2.5 For reference: RHEL-5 ships with python 2.4. Which makes me think at least the hashlib one needs a more sophisticated approach so it keeps working on pre-2.5 versions ... cheers, Gerd _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Tue, Mar 10, 2009 at 02:44:19PM +0100, Gerd Hoffmann wrote:> > Can you please confirm in which Python version the new modules were > > introduced ? Some people (including our automatic test systems!) are > > using very old versions of python and it would be nice if that kept > > working. > > set type (obsoletes sets module) was added in 2.4 > hashlib (obsoletes sha module) was added in 2.5We''re using 2.4 too (we have 2.5, and 2.6, but haven''t yet done the work to move versions). regards john _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
>>> Gerd Hoffmann <kraxel@redhat.com> 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 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich wrote:>>>> Gerd Hoffmann <kraxel@redhat.com> 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).> -import sha > +try: > + import hashlib # python v2.6 or newer > +except ImportError: > + import sha # python v2.5 or olderWell, due to the renaming (sha.sha -> hashlib.sha1) it isn''t *that* easy. Patch below could work. WARNING: untested. cheers, Gerd _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich schrieb:>>>> Gerd Hoffmann <kraxel@redhat.com> 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@lists.xensource.com http://lists.xensource.com/xen-devel
Gerd Hoffmann writes ("Re: [Xen-devel] [patch] fix python 2.6 warnings"):> set type (obsoletes sets module) was added in 2.4 > hashlib (obsoletes sha module) was added in 2.5 > > For reference: RHEL-5 ships with python 2.4.The automated test systems which manage propagation from staging to xen-unstable are running python 2.3. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel