From 0fcc524c6b5e214c95d815df41a39598c195530b Mon Sep 17 00:00:00 2001 From: Stewart Adam Date: Sat, 7 Feb 2009 18:01:43 +0000 Subject: [PATCH] - Oops, actually apply the patch - Modify patch so modules remain compatible with PEP 247 --- pycrypto-2.0.1-hashlib.patch | 56 ++++++++++++++++++++++++------------ python-crypto.spec | 9 +++++- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/pycrypto-2.0.1-hashlib.patch b/pycrypto-2.0.1-hashlib.patch index 5de9741..33bda64 100644 --- a/pycrypto-2.0.1-hashlib.patch +++ b/pycrypto-2.0.1-hashlib.patch @@ -1,33 +1,53 @@ ---- HMAC.py.old 2009-02-07 09:08:31.000000000 -0500 -+++ HMAC.py 2009-02-07 09:09:08.000000000 -0500 -@@ -33,7 +33,7 @@ +--- Hash/HMAC.py.old 2002-07-25 13:19:02.000000000 -0400 ++++ Hash/HMAC.py 2009-02-07 12:32:36.000000000 -0500 +@@ -33,8 +33,8 @@ digestmod: A module supporting PEP 247. Defaults to the md5 module. """ if digestmod == None: - import md5 -+ from hashlib import md5 - digestmod = md5 +- digestmod = md5 ++ import MD5 ++ digestmod = MD5 self.digestmod = digestmod ---- MD5.py.old 2009-02-07 09:08:22.000000000 -0500 -+++ MD5.py 2009-02-07 09:09:22.000000000 -0500 -@@ -3,7 +3,7 @@ + self.outer = digestmod.new() +--- Hash/MD5.py.old 2002-07-11 10:31:19.000000000 -0400 ++++ Hash/MD5.py 2009-02-07 12:50:48.000000000 -0500 +@@ -3,11 +3,10 @@ __revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" -from md5 import * -+from hashlib import md5 ++import hashlib - import md5 - if hasattr(md5, 'digestsize'): ---- SHA.py.old 2009-02-07 09:08:38.000000000 -0500 -+++ SHA.py 2009-02-07 09:09:32.000000000 -0500 -@@ -3,7 +3,7 @@ +-import md5 +-if hasattr(md5, 'digestsize'): +- digest_size = digestsize +- del digestsize +-del md5 ++new = hashlib.md5 ++md5 = hashlib.md5 + ++blocksize = hashlib.md5().block_size ++digest_size = hashlib.md5().digest_size +--- Hash/SHA.py.old 2002-07-11 10:31:19.000000000 -0400 ++++ Hash/SHA.py 2009-02-07 12:50:17.000000000 -0500 +@@ -3,9 +3,10 @@ __revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling Exp $" -from sha import * -+from hashlib import sha - import sha - if hasattr(sha, 'digestsize'): - digest_size = digestsize +-import sha +-if hasattr(sha, 'digestsize'): +- digest_size = digestsize +- del digestsize +-del sha ++import hashlib ++ ++new = hashlib.sha1 ++sha = hashlib.sha1 ++ ++blocksize = hashlib.sha1().block_size ++digest_size = hashlib.sha1().digest_size +o + diff --git a/python-crypto.spec b/python-crypto.spec index b49bc39..373a206 100644 --- a/python-crypto.spec +++ b/python-crypto.spec @@ -4,12 +4,14 @@ Summary: Cryptography library for Python Name: python-crypto Version: 2.0.1 -Release: 15 +Release: 15.1 License: Public Domain Group: Development/Libraries # FIXME: In the near future, new releases will be at http://www.dlitz.net/software/pycrypto/ URL: http://www.amk.ca/python/code/crypto.html Source: http://www.amk.ca/files/python/crypto/pycrypto-2.0.1.tar.gz +Patch0: pycrypto-2.0.1-hashlib.patch + Provides: pycrypto = %{version}-%{release} BuildRequires: python >= 2.2 BuildRequires: python-devel >= 2.2 @@ -26,6 +28,7 @@ etc.). %setup -n pycrypto-%{version} -q sed -i s:/lib:/%_lib:g setup.py +%patch0 -b .hashlib %build CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build @@ -63,6 +66,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sat Feb 7 2009 Stewart Adam - 2.0.1-15.1 +- Oops, actually apply the patch +- Modify patch so modules remain compatible with PEP 247 + * Sat Feb 7 2009 Stewart Adam - 2.0.1-15 - Add patch to hashlib instead of deprecated md5 and sha modules (#484473)