1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

- Add a patch to make SHA and MD5 use hashlib if possible

- Transfer maintainership to submitter

PR:		ports/135832
Submitted by:	Keith Gaughan <kmgaughan AT eircom.net>
This commit is contained in:
Li-Wen Hsu 2009-07-16 13:46:55 +00:00
parent b78c2662fd
commit 3d0a9798fa
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=237925
2 changed files with 67 additions and 3 deletions

View File

@ -7,12 +7,12 @@
PORTNAME= pycrypto
PORTVERSION= 2.0.1
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= security python
MASTER_SITES= http://www.amk.ca/files/python/crypto/
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= ports@FreeBSD.org
MAINTAINER= kmgaughan@eircom.net
COMMENT= The Python Cryptography Toolkit
USE_PYTHON= yes
@ -23,4 +23,10 @@ LIB_DEPENDS+= gmp.8:${PORTSDIR}/math/libgmp4
pre-configure:
@${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|" ${WRKSRC}/setup.py
.include <bsd.port.mk>
.include <bsd.port.pre.mk>
.if (${PYTHON_REL} >= 250)
EXTRA_PATCHES+= ${FILESDIR}/python25+.txt
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,58 @@
--- Hash/MD5.py.orig 2009-06-19 12:46:41.000000000 +0100
+++ Hash/MD5.py 2009-06-19 12:50:24.000000000 +0100
@@ -3,11 +3,20 @@
__revision__ = "$Id: MD5.py,v 1.4 2002/07/11 14:31:19 akuchling 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
--- Hash/SHA.py.orig 2009-06-19 12:46:52.000000000 +0100
+++ Hash/SHA.py 2009-06-19 12:49:49.000000000 +0100
@@ -3,9 +3,20 @@
__revision__ = "$Id: SHA.py,v 1.4 2002/07/11 14:31:19 akuchling 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