From owner-svn-ports-head@FreeBSD.ORG Thu Oct 4 16:45:41 2012 Return-Path: Delivered-To: svn-ports-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C8D0D106566B; Thu, 4 Oct 2012 16:45:41 +0000 (UTC) (envelope-from jgh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A80DA8FC1C; Thu, 4 Oct 2012 16:45:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q94Gjf6D088202; Thu, 4 Oct 2012 16:45:41 GMT (envelope-from jgh@svn.freebsd.org) Received: (from jgh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q94Gjfol088197; Thu, 4 Oct 2012 16:45:41 GMT (envelope-from jgh@svn.freebsd.org) Message-Id: <201210041645.q94Gjfol088197@svn.freebsd.org> From: Jason Helfman Date: Thu, 4 Oct 2012 16:45:41 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r305266 - in head/security/py-pycrypto: . files X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Oct 2012 16:45:41 -0000 Author: jgh Date: Thu Oct 4 16:45:41 2012 New Revision: 305266 URL: http://svn.freebsd.org/changeset/ports/305266 Log: - Make GMP OPTION'al - Add upstream patch for test failure when built without GMP PR: 172299 Submitted by: koobs.freebsd@gmail.com Added: head/security/py-pycrypto/files/patch-lib__Crypto__SelfTest__Util__test_number.py (contents, props changed) Modified: head/security/py-pycrypto/Makefile (contents, props changed) head/security/py-pycrypto/files/patch-setup.py (contents, props changed) head/security/py-pycrypto/pkg-plist (contents, props changed) Modified: head/security/py-pycrypto/Makefile ============================================================================== --- head/security/py-pycrypto/Makefile Thu Oct 4 16:35:25 2012 (r305265) +++ head/security/py-pycrypto/Makefile Thu Oct 4 16:45:41 2012 (r305266) @@ -1,12 +1,10 @@ -# New ports collection makefile for: pycrypto -# Date created: 25 Oct 2002 -# Whom: nbm +# Created by: nbm # # $FreeBSD$ -# PORTNAME= pycrypto PORTVERSION= 2.6 +PORTREVISION= 1 CATEGORIES= security python MASTER_SITES= CHEESESHOP \ https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/ @@ -15,17 +13,37 @@ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= jgh@FreeBSD.org COMMENT= The Python Cryptography Toolkit -USE_PYTHON= yes -USE_PYDISTUTILS=yes +USE_PYTHON= yes +USE_PYDISTUTILS= yes HAS_CONFIGURE= yes USE_AUTOTOOLS= autoconf -CPPFLAGS+= -I${LOCALBASE}/include -LDFLAGS+= -L${LOCALBASE}/lib -LIB_DEPENDS+= gmp.10:${PORTSDIR}/math/gmp +OPTIONS_DEFINE= GMP +OPTIONS_DEFAULT= GMP +GMP_DESC= Use GMP for faster DSA/RSA operations + +OPTIONSFILE?= ${PORT_DBDIR}/py-${PORTNAME}/options + +.include + +.if ${PORT_OPTIONS:MGMP} +LIB_DEPENDS+= gmp:${PORTSDIR}/math/gmp +CONFIGURE_ARGS+= --with-gmp +CPPFLAGS+= -I${LOCALBASE}/include +LDFLAGS+= -L${LOCALBASE}/lib +PLIST_SUB+= GMP="" +.else +CONFIGURE_ARGS+= --without-gmp +PLIST_SUB+= GMP="@comment " +.endif pre-patch: @${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|" ${WRKSRC}/setup.py +test: build + cd ${WRKSRC} && ${PYTHON_CMD} ${PYSETUP} test + +regression-test: test + .include Added: head/security/py-pycrypto/files/patch-lib__Crypto__SelfTest__Util__test_number.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/security/py-pycrypto/files/patch-lib__Crypto__SelfTest__Util__test_number.py Thu Oct 4 16:45:41 2012 (r305266) @@ -0,0 +1,37 @@ +--- ./lib/Crypto/SelfTest/Util/test_number.py.orig 2012-10-03 16:03:52.000000000 +1000 ++++ ./lib/Crypto/SelfTest/Util/test_number.py 2012-10-03 16:04:01.000000000 +1000 +@@ -276,6 +276,11 @@ + self.assertEqual(number.size(0xa2ba40),8*3) + self.assertEqual(number.size(0xa2ba40ee07e3b2bd2f02ce227f36a195024486e49c19cb41bbbdfbba98b22b0e577c2eeaffa20d883a76e65e394c69d4b3c05a1e8fadda27edb2a42bc000fe888b9b32c22d15add0cd76b3e7936e19955b220dd17d4ea904b1ec102b2e4de7751222aa99151024c7cb41cc5ea21d00eeb41f7c800834d2c6e06bce3bce7ea9a5L), 1024) + ++class FastmathTests(unittest.TestCase): ++ def setUp(self): ++ global number ++ from Crypto.Util import number ++ + def test_negative_number_roundtrip_mpzToLongObj_longObjToMPZ(self): + """Test that mpzToLongObj and longObjToMPZ (internal functions) roundtrip negative numbers correctly.""" + n = -100000000000000000000000000000000000L +@@ -286,7 +291,21 @@ + + def get_tests(config={}): + from Crypto.SelfTest.st_common import list_test_cases +- return list_test_cases(MiscTests) ++ tests = list_test_cases(MiscTests) ++ try: ++ from Crypto.PublicKey import _fastmath ++ tests += list_test_cases(FastmathTests) ++ except ImportError: ++ from distutils.sysconfig import get_config_var ++ import inspect, os.path ++ _fm_path = os.path.normpath(os.path.dirname(os.path.abspath( ++ inspect.getfile(inspect.currentframe()))) ++ +"/../../PublicKey/_fastmath"+get_config_var("SO")) ++ if os.path.exists(_fm_path): ++ raise ImportError("While the _fastmath module exists, importing "+ ++ "it failed. This may point to the gmp or mpir shared library "+ ++ "not being in the path. _fastmath was found at "+_fm_path) ++ return tests + + if __name__ == '__main__': + suite = lambda: unittest.TestSuite(get_tests()) Modified: head/security/py-pycrypto/files/patch-setup.py ============================================================================== --- head/security/py-pycrypto/files/patch-setup.py Thu Oct 4 16:35:25 2012 (r305265) +++ head/security/py-pycrypto/files/patch-setup.py Thu Oct 4 16:45:41 2012 (r305266) @@ -1,6 +1,6 @@ ---- setup.py.orig 2011-11-01 17:47:23.000000000 +0400 -+++ setup.py 2011-11-01 17:54:51.000000000 +0400 -@@ -177,6 +177,7 @@ +--- ./setup.py.orig 2012-10-03 15:57:50.000000000 +1000 ++++ ./setup.py 2012-10-03 15:57:50.000000000 +1000 +@@ -136,6 +136,7 @@ # especially helps the DES modules. self.__add_compiler_option("-O3") self.__add_compiler_option("-fomit-frame-pointer") Modified: head/security/py-pycrypto/pkg-plist ============================================================================== --- head/security/py-pycrypto/pkg-plist Thu Oct 4 16:35:25 2012 (r305265) +++ head/security/py-pycrypto/pkg-plist Thu Oct 4 16:45:41 2012 (r305266) @@ -115,7 +115,7 @@ %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/__init__.py %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/__init__.pyc %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/__init__.pyo -%%PYTHON_SITELIBDIR%%/Crypto/PublicKey/_fastmath.so +%%GMP%%%%PYTHON_SITELIBDIR%%/Crypto/PublicKey/_fastmath.so %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/_slowmath.py %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/_slowmath.pyc %%PYTHON_SITELIBDIR%%/Crypto/PublicKey/_slowmath.pyo