diff --git a/devel/py-rauth/Makefile b/devel/py-rauth/Makefile index 6272c472192a..4f9afe90e48b 100644 --- a/devel/py-rauth/Makefile +++ b/devel/py-rauth/Makefile @@ -1,24 +1,25 @@ PORTNAME= rauth PORTVERSION= 0.7.2 +PORTREVISION= 1 CATEGORIES= devel www python PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= bofh@FreeBSD.org COMMENT= Python library for OAuth 1.0/a, 2.0, and Ofly consumers WWW= https://github.com/litl/rauth LICENSE= MIT LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}requests>=1.2.3:www/py-requests@${PY_FLAVOR} TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}mock>=1.0.1:devel/py-mock@${PY_FLAVOR} \ ${PYTHON_PKGNAMEPREFIX}pycryptodome>0:security/py-pycryptodome@${PY_FLAVOR} USES= python:3.6+ USE_GITHUB= yes GH_ACCOUNT= litl USE_PYTHON= autoplist distutils nose NO_ARCH= yes .include diff --git a/devel/py-rauth/files/patch-rauth__oauth.py b/devel/py-rauth/files/patch-rauth__oauth.py new file mode 100644 index 000000000000..9a829f92bf22 --- /dev/null +++ b/devel/py-rauth/files/patch-rauth__oauth.py @@ -0,0 +1,29 @@ +commit 7fb3b7bf1a1869a52cf59ee3eb607d318e97265c +Author: John W. O'Brien +Date: Mon Jul 27 14:56:02 2020 -0400 + + Support PyCryptodome as alternative to PyCrypto + +--- rauth/oauth.py.orig 2015-11-05 16:01:31 UTC ++++ rauth/oauth.py +@@ -171,7 +171,8 @@ class RsaSha1Signature(SignatureMethod): + from Crypto.Signature import PKCS1_v1_5 as p + self.RSA, self.SHA, self.PKCS1_v1_5 = r, s, p + except ImportError: # pragma: no cover +- raise NotImplementedError('PyCrypto is required for ' + self.NAME) ++ raise NotImplementedError('PyCrypto(dome) is required for ' ++ + self.NAME) + + def sign(self, + consumer_secret, +@@ -208,7 +209,9 @@ class RsaSha1Signature(SignatureMethod): + # resolve the key + if is_basestring(consumer_secret): + consumer_secret = self.RSA.importKey(consumer_secret) +- if not isinstance(consumer_secret, self.RSA._RSAobj): ++ valid_cls = (getattr(self.RSA, '_RSAobj', False) ++ or getattr(self.RSA, 'RsaKey', False)) ++ if not (valid_cls and isinstance(consumer_secret, valid_cls)): + raise ValueError('invalid consumer_secret') + + # hash the string with RSA-SHA1 diff --git a/devel/py-rauth/files/patch-setup.py b/devel/py-rauth/files/patch-setup.py index ec3c9a39b67d..6594fc1996a5 100644 --- a/devel/py-rauth/files/patch-setup.py +++ b/devel/py-rauth/files/patch-setup.py @@ -1,34 +1,34 @@ --- setup.py.orig 2015-11-05 16:01:31 UTC +++ setup.py @@ -20,14 +20,16 @@ about = {} with open('rauth/__about__.py') as f: exec(f.read(), about) -if sys.argv[-1] == 'test': - status = os.system('make check') - status >>= 8 - sys.exit(status) - install_requires = ['requests>=1.2.3'] + +tests_require = [ + 'nose', + 'mock', -+ 'pycrypto', ++ 'pycryptodome', +] + if sys.version_info[0] == 2 and sys.version_info[1] < 7: - install_requires.append('unittest2>=0.5.1') + tests_require = ['unittest2>=0.5.1'] classifiers = ['Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', @@ -57,6 +59,8 @@ setup(name=about['__title__'], url='https://github.com/litl/rauth', packages=find_packages(), install_requires=install_requires, + tests_require=tests_require, + test_suite='nose.collector', license=about['__license__'], keywords='oauth oauth2 rauth requests', classifiers=classifiers,