From: "Marc - A. Dahlhaus" <mad@wol.de>
To: Jan Beulich <jbeulich@novell.com>
Cc: Jim Fehlig <JFEHLIG@novell.com>,
Xen Development Mailing List <xen-devel@lists.xensource.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [patch] fix python 2.6 warnings
Date: Tue, 10 Mar 2009 17:49:49 +0100 [thread overview]
Message-ID: <49B69A2D.8040008@wol.de> (raw)
In-Reply-To: <49B68AAE.76E4.0078.0@novell.com>
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
next prev parent reply other threads:[~2009-03-10 16:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 11:28 [patch] fix python 2.6 warnings Gerd Hoffmann
2009-03-10 12:16 ` Gerd Hoffmann
2009-03-10 12:18 ` Ian Jackson
2009-03-10 13:44 ` Gerd Hoffmann
2009-03-10 14:20 ` John Levon
2009-03-10 14:43 ` Jan Beulich
2009-03-10 15:52 ` Gerd Hoffmann
2009-03-10 16:49 ` Marc - A. Dahlhaus [this message]
2009-03-10 17:49 ` Ian Jackson
2009-03-10 12:28 ` M A Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49B69A2D.8040008@wol.de \
--to=mad@wol.de \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JFEHLIG@novell.com \
--cc=jbeulich@novell.com \
--cc=kraxel@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.