diff options
author | Jesus Rivero <neurogeek@gentoo.org> | 2009-03-01 08:24:02 +0000 |
---|---|---|
committer | Jesus Rivero <neurogeek@gentoo.org> | 2009-03-01 08:24:02 +0000 |
commit | 76955c040301bce64c44bc160d042c3e8422fb8d (patch) | |
tree | b767e064986a1336e3125c2642ebd75a63bedc5a /dev-python/pycrypto | |
parent | Version bump. Fixes bug #260690. (diff) | |
download | gentoo-2-76955c040301bce64c44bc160d042c3e8422fb8d.tar.gz gentoo-2-76955c040301bce64c44bc160d042c3e8422fb8d.tar.bz2 gentoo-2-76955c040301bce64c44bc160d042c3e8422fb8d.zip |
Version bump. Fixes bug #246406 2.6 (deprecation warnings). Thanks to Christian Becke for the patches.
(Portage version: 2.2_rc20/cvs/Linux 2.6.27-gentoo-r7 i686)
Diffstat (limited to 'dev-python/pycrypto')
-rw-r--r-- | dev-python/pycrypto/ChangeLog | 11 | ||||
-rw-r--r-- | dev-python/pycrypto/files/pycrypto-2.0.1-2.6_hashlib.patch | 93 | ||||
-rw-r--r-- | dev-python/pycrypto/pycrypto-2.0.1-r7.ebuild | 57 |
3 files changed, 159 insertions, 2 deletions
diff --git a/dev-python/pycrypto/ChangeLog b/dev-python/pycrypto/ChangeLog index 0a890d40f61e..2031efecfa56 100644 --- a/dev-python/pycrypto/ChangeLog +++ b/dev-python/pycrypto/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for dev-python/pycrypto -# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/ChangeLog,v 1.63 2008/08/21 06:20:27 ricmm Exp $ +# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/ChangeLog,v 1.64 2009/03/01 08:24:02 neurogeek Exp $ + +*pycrypto-2.0.1-r7 (01 Mar 2009) + + 01 Mar 2009; <neurogeek@gentoo.org> + +files/pycrypto-2.0.1-2.6_hashlib.patch, +pycrypto-2.0.1-r7.ebuild: + Version bump. Fixes bug #246406 2.6 (deprecation warnings). Thanks to + Christian Becke for the patches. 21 Aug 2008; Ricardo Mendoza <ricmm@gentoo.org> pycrypto-2.0.1-r5.ebuild, pycrypto-2.0.1-r6.ebuild: diff --git a/dev-python/pycrypto/files/pycrypto-2.0.1-2.6_hashlib.patch b/dev-python/pycrypto/files/pycrypto-2.0.1-2.6_hashlib.patch new file mode 100644 index 000000000000..9ee7e17eb0f6 --- /dev/null +++ b/dev-python/pycrypto/files/pycrypto-2.0.1-2.6_hashlib.patch @@ -0,0 +1,93 @@ +#From: Dwayne C. Litzenberger <dlitz@dlitz.net> +#Date: Sun, 14 Sep 2008 19:30:59 +0000 (-0400) +#Subject: Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5... +#X-Git-Url: http://gitweb.pycrypto.org/?p=crypto%2Fpycrypto-2.x.git;a=commitdiff_plain;h=d2311689910240e425741a546576129f4c9735e2 +# +#Python 2.6 compatibility: When possible, use hashlib instead of the deprecated 'md5' and 'sha' modules +#--- +# +#diff --git a/Hash/MD5.py b/Hash/MD5.py +#index bdbc62a..e79a85f 100644 +--- a/Hash/MD5.py ++++ b/Hash/MD5.py +@@ -3,11 +3,21 @@ + + __revision__ = "$Id: pycrypto-2.0.1-2.6_hashlib.patch,v 1.1 2009/03/01 08:24:02 neurogeek Exp $" + +-from md5 import * ++__all__ = ['new', 'digest_size'] + +-import md5 +-if hasattr(md5, 'digestsize'): +- digest_size = digestsize +- del digestsize +-del md5 ++try: ++ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. ++ import hashlib ++ def new(data=""): ++ return hashlib.md5(data) ++ digest_size = new().digest_size ++ ++except ImportError: ++ from md5 import * ++ ++ import md5 ++ if hasattr(md5, 'digestsize'): ++ digest_size = digestsize ++ del digestsize ++ del md5 + +diff --git a/Hash/SHA.py b/Hash/SHA.py +index dc05502..f4128ec 100644 +--- a/Hash/SHA.py ++++ b/Hash/SHA.py +@@ -3,9 +3,19 @@ + + __revision__ = "$Id: pycrypto-2.0.1-2.6_hashlib.patch,v 1.1 2009/03/01 08:24:02 neurogeek Exp $" + +-from sha import * +-import sha +-if hasattr(sha, 'digestsize'): +- digest_size = digestsize +- del digestsize +-del sha ++__all__ = ['new', 'digest_size'] ++ ++try: ++ # The md5 module is deprecated in Python 2.6, so use hashlib when possible. ++ import hashlib ++ def new(data=""): ++ return hashlib.sha1(data) ++ digest_size = new().digest_size ++ ++except ImportError: ++ from sha import * ++ import sha ++ if hasattr(sha, 'digestsize'): ++ digest_size = digestsize ++ del digestsize ++ del sha +#From: Dwayne C. Litzenberger <dlitz@dlitz.net> +#Date: Sun, 14 Sep 2008 21:38:52 +0000 (-0400) +#Subject: Python 2.6 compatibility: Use Hash.MD5 instead of Python "md5" module in the HMAC... +#X-Git-Url: http://gitweb.pycrypto.org/?p=crypto%2Fpycrypto-2.0.x.git;a=commitdiff_plain;h=84b793416b52311643bfd456a4544444afbfb5da +# +#Python 2.6 compatibility: Use Hash.MD5 instead of Python "md5" module in the HMAC module. +#--- + +#diff --git a/Hash/HMAC.py b/Hash/HMAC.py +#index b8a9229..6ed9556 100644 +--- a/Hash/HMAC.py ++++ b/Hash/HMAC.py +@@ -33,8 +33,8 @@ class HMAC: + digestmod: A module supporting PEP 247. Defaults to the md5 module. + """ + if digestmod == None: +- import md5 +- digestmod = md5 ++ import MD5 ++ digestmod = MD5 + + self.digestmod = digestmod + self.outer = digestmod.new() diff --git a/dev-python/pycrypto/pycrypto-2.0.1-r7.ebuild b/dev-python/pycrypto/pycrypto-2.0.1-r7.ebuild new file mode 100644 index 000000000000..b57da4f3b3fc --- /dev/null +++ b/dev-python/pycrypto/pycrypto-2.0.1-r7.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-python/pycrypto/pycrypto-2.0.1-r7.ebuild,v 1.1 2009/03/01 08:24:02 neurogeek Exp $ + +NEED_PYTHON=2.5 +inherit distutils toolchain-funcs flag-o-matic + +DESCRIPTION="Python Cryptography Toolkit" +HOMEPAGE="http://www.amk.ca/python/code/crypto.html" +SRC_URI="http://www.amk.ca/files/python/crypto/${P}.tar.gz" + +LICENSE="freedist" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" +IUSE="bindist gmp test" + +RDEPEND="virtual/python + gmp? ( dev-libs/gmp )" +DEPEND="${RDEPEND} + test? ( =dev-python/sancho-0.11-r1 )" + +src_unpack() { + unpack ${A} + cd "${S}" + use bindist && epatch "${FILESDIR}"/${P}-bindist.patch + epatch "${FILESDIR}"/${P}-sha256.patch + epatch "${FILESDIR}"/${P}-sha256-2.patch + epatch "${FILESDIR}"/${P}-gmp.patch + epatch "${FILESDIR}"/${P}-uint32.patch + epatch "${FILESDIR}"/${P}-sancho-package-rename.patch + epatch "${FILESDIR}"/${P}-2.6_hashlib.patch +} + +src_compile() { + use gmp \ + && export USE_GMP=1 \ + || export USE_GMP=0 + # sha256 hashes occasionally trigger ssp when built with + # -finline-functions (implied by -O3). + gcc-specs-ssp && append-flags -fno-inline-functions + distutils_src_compile + python_need_rebuild +} + +src_test() { + export PYTHONPATH=$(ls -d "${S}"/build/lib.*/) + python ./test.py || die "test failed" + if use test ; then + local x + cd test + for x in test_*.py ; do + python ${x} || die "${x} failed" + done + fi +} + +DOCS="ACKS ChangeLog PKG-INFO README TODO Doc/pycrypt.tex" |