From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RPgkZ-00017Y-9w for garchives@archives.gentoo.org; Sun, 13 Nov 2011 20:33:59 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 70B1021C043; Sun, 13 Nov 2011 20:33:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 4163521C043 for ; Sun, 13 Nov 2011 20:33:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BB2D41B4009 for ; Sun, 13 Nov 2011 20:33:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id CD89380042 for ; Sun, 13 Nov 2011 20:33:50 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/checksum.py X-VCS-Directories: pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e1a671011993a7ebb73845b3ac12fea80bfc2074 Date: Sun, 13 Nov 2011 20:33:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: e25a90d5-3350-4df2-a49a-47a69ec07c61 X-Archives-Hash: 21f5e350877f6330d2003d37b47eb16e commit: e1a671011993a7ebb73845b3ac12fea80bfc2074 Author: Zac Medico gentoo org> AuthorDate: Sun Nov 13 20:33:43 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Nov 13 20:33:43 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3De1a67101 checksum.py: handle pycrypto breakage --- pym/portage/checksum.py | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py index 8e5abff..f10fc4d 100644 --- a/pym/portage/checksum.py +++ b/pym/portage/checksum.py @@ -99,10 +99,18 @@ except ImportError: pass =20 # Use pycrypto when available, prefer it over the internal fallbacks +# Check for 'new' attributes, since they can be missing if the module +# is broken somehow. try: from Crypto.Hash import SHA256, RIPEMD - sha256hash =3D _generate_hash_function("SHA256", SHA256.new, origin=3D"= pycrypto") - rmd160hash =3D _generate_hash_function("RMD160", RIPEMD.new, origin=3D"= pycrypto") + sha256hash =3D getattr(SHA256, 'new', None) + if sha256hash is not None: + sha256hash =3D _generate_hash_function("SHA256", + sha256hash, origin=3D"pycrypto") + rmd160hash =3D getattr(RIPEMD, 'new', None) + if rmd160hash is not None: + rmd160hash =3D _generate_hash_function("RMD160", + rmd160hash, origin=3D"pycrypto") except ImportError: pass =20