[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Duplicity-talk] Version 0.5.04 on openSuse 11.1 - deprecation warni
From: |
Adam Mercer |
Subject: |
Re: [Duplicity-talk] Version 0.5.04 on openSuse 11.1 - deprecation warning |
Date: |
Sun, 28 Dec 2008 16:54:49 +0000 |
On Sun, Dec 28, 2008 at 16:40, Michael Schneider
<address@hidden> wrote:
> Dear all,
>
> after upgrading my OS to Opensuse 11.1 and installing duplicity 0.5.04,
> I get the following warnings:
> /usr/lib/python2.6/site-packages/duplicity/gpg.py:23: DeprecationWarning:
> the sha module is deprecated;
> /usr/lib/python2.6/site-packages/duplicity/gpg.py:23: DeprecationWarning:
> the md5 module is deprecated;
>
> I got rid of these warnings by patching gpg.py as follows:
<snip>
This won't work on python24 and under as the hashlib module isn't
available, it was introduced in python25. Therefore something like the
following will probably be needed:
--- gpg.py 2008-12-28 16:48:59.000000000 +0000
+++ gpg.py 2008-12-28 16:51:14.000000000 +0000
@@ -20,9 +20,16 @@
"""duplicity's gpg interface, builds upon Frank Tobin's GnuPGInterface"""
-import select, os, sys, thread, sha, md5, types, cStringIO, tempfile, re, gzip
+import select, os, sys, thread, types, cStringIO, tempfile, re, gzip
import GnuPGInterface, misc, log
+try:
+ from hashlib import sha1
+ from hashlib import md5
+except ImportError:
+ from sha import new as sha1
+ from md5 import new as md5
+
blocksize = 256 * 1024
# user options appended by --gpg-options
@@ -303,9 +310,9 @@
assert path.isreg()
fp = path.open("rb")
if hash == "SHA1":
- hash_obj = sha.new()
+ hash_obj = sha1()
elif hash == "MD5":
- hash_obj = md5.new()
+ hash_obj = md5()
else:
assert 0, "Unknown hash %s" % (hash,)
I haven't tested this, but I have converted a few codes that used the
md5/sha modules to use hashlib this way and no python24 users have
complained.
Cheers
Adam