[jabberpy/el6] 621204 - fix sha module deprecation warning

Milan Zazrivec mzazrive at fedoraproject.org
Tue Mar 20 09:54:08 UTC 2012


commit 1b90fb407c96199ec937e452618548e5860aad35
Author: Milan Zazrivec <mzazrivec at redhat.com>
Date:   Tue Mar 20 10:53:35 2012 +0100

    621204 - fix sha module deprecation warning

 jabberpy-sha-deprecation.patch |   40 ++++++++++++++++++++++++++++++++++++++++
 jabberpy.spec                  |    7 ++++++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/jabberpy-sha-deprecation.patch b/jabberpy-sha-deprecation.patch
new file mode 100644
index 0000000..60c688a
--- /dev/null
+++ b/jabberpy-sha-deprecation.patch
@@ -0,0 +1,40 @@
+--- jabber/jabber.py   2011-02-22 11:15:44.706037736 +0100
++++ jabber/jabber.py   2011-02-22 11:31:25.628921665 +0100
+@@ -65,7 +65,8 @@
+ # $Id: jabber.py,v 1.58 2004/01/18 05:27:10 snakeru Exp $
+ 
+ import xmlstream
+-import sha, time
++import time
++import hashlib
+ 
+ debug=xmlstream.debug
+ 
+@@ -524,7 +525,7 @@
+             token = auth_ret_query.getTag('token').getData()
+             seq = auth_ret_query.getTag('sequence').getData()
+             self.DEBUG("zero-k authentication supported",(DBG_INIT,DBG_NODE_IQ))
+-            hash = sha.new(sha.new(passwd).hexdigest()+token).hexdigest()
++            hash = hashlib.new('sha1', hashlib.new('sha1', passwd).hexdigest()+token).hexdigest()
+             for foo in xrange(int(seq)): hash = sha.new(hash).hexdigest()
+             q.insertTag('hash').insertData(hash)
+ 
+@@ -532,7 +533,7 @@
+ 
+             self.DEBUG("digest authentication supported",(DBG_INIT,DBG_NODE_IQ))
+             digest = q.insertTag('digest')
+-            digest.insertData(sha.new(
++            digest.insertData(hashlib.new('sha1',
+                 self.getIncomingID() + passwd).hexdigest() )
+         else:
+             self.DEBUG("plain text authentication supported",(DBG_INIT,DBG_NODE_IQ))
+@@ -1397,7 +1398,7 @@
+     def auth(self,secret):
+         """will disconnect on failure"""
+         self.send( u"<handshake id='1'>%s</handshake>"
+-                   % sha.new( self.getIncomingID() + secret ).hexdigest()
++                   % hashlib.new('sha1', self.getIncomingID() + secret ).hexdigest()
+                   )
+         while not self._auth_OK:
+             self.DEBUG("waiting on handshake")
+
diff --git a/jabberpy.spec b/jabberpy.spec
index 87092bf..a640b38 100644
--- a/jabberpy.spec
+++ b/jabberpy.spec
@@ -2,7 +2,7 @@
 Name:          jabberpy
 Version:       0.5
 # Used like this because upstream releases like 0.5-0
-Release:       0.21%{?dist}
+Release:       0.22%{?dist}
 Summary:       Python xmlstream and jabber IM protocol libs
 
 Group:         Development/Libraries
@@ -12,6 +12,7 @@ Source0:       http://downloads.sf.net/sourceforge/%{name}/%{name}-%{version}-0.
 Patch0:        jabberpy-no-init.patch
 Patch1:        jabberpy-clean-sockets.patch
 Patch2:        jabberpy-ipv6.patch
+Patch3:        jabberpy-sha-deprecation.patch
 
 BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:     noarch
@@ -31,6 +32,7 @@ chmod -x examples/*.py
 %patch0 -p1 -b .no-init
 %patch1 -p1 -b .clean-sockets
 %patch2 -p0 -b .ipv6
+%patch3 -p0 -b .sha-deprecation
 
 %build
 %{__python} setup.py  build
@@ -49,6 +51,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue Mar 20 2012 Milan Zazrivec <mzazrivec at redhat.com> 0.5-0.22
+- fix sha module deprecation warning
+
 * Fri Sep 23 2011 Milan Zazrivec <mzazrivec at redhat.com> 0.5-0.21
 - 670881 - IPv6 support for jabberpy
 


More information about the scm-commits mailing list