[packages/python-pyjwt] - updated to 1.7.1 - added tests patch (allow pytest 5, seems to work; adjust for ecdsa 0.14+)
qboosh
qboosh at pld-linux.org
Wed Jan 20 21:51:32 CET 2021
commit d749d6e407f9e73e3e6b3fc3fee8d31ffd7de5b2
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Wed Jan 20 21:51:40 2021 +0100
- updated to 1.7.1
- added tests patch (allow pytest 5, seems to work; adjust for ecdsa 0.14+)
python-pyjwt-tests.patch | 29 +++++++++++++++++++++
python-pyjwt.spec | 68 ++++++++++++++++++++++++++++++++----------------
2 files changed, 74 insertions(+), 23 deletions(-)
---
diff --git a/python-pyjwt.spec b/python-pyjwt.spec
index 2664c2d..bb27cb1 100644
--- a/python-pyjwt.spec
+++ b/python-pyjwt.spec
@@ -1,40 +1,49 @@
#
# Conditional build:
-%bcond_with doc # don't build doc
-%bcond_with tests # do not perform "make test"
+%bcond_with tests # unit tests
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
%define module pyjwt
-Summary: JSON Web Token implementation in Python
+Summary: JSON Web Token implementation in Python 2
+Summary(pl.UTF-8): Implementacja JSON Web Token w Pythonie 2
Name: python-%{module}
-Version: 1.4.0
-Release: 4
+# keep 1.x here for python2 support
+Version: 1.7.1
+Release: 1
License: MIT
Group: Libraries/Python
+#Source0Download: https://pypi.org/simple/pyjwt/
Source0: https://files.pythonhosted.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz
-# Source0-md5: 2f9bd9226d72b13d19d2c557114d03dc
+# Source0-md5: a4712f980c008696e13e09504120b2a0
+Patch0: %{name}-tests.patch
URL: http://github.com/jpadilla/pyjwt
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
%if %{with python2}
-BuildRequires: python-modules
+BuildRequires: python-modules >= 1:2.7
BuildRequires: python-setuptools
%if %{with tests}
-BuildRequires: python-pytest
-BuildRequires: python-pytest-cov
-BuildRequires: python-pytest-runner
+BuildRequires: python-Crypto
+BuildRequires: python-ecdsa
+BuildRequires: python-pytest >= 4.0.1
+BuildRequires: python-pytest-cov >= 2.6.0
+BuildRequires: python-pytest-runner >= 4.2
%endif
%endif
%if %{with python3}
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.4
BuildRequires: python3-setuptools
%if %{with tests}
-BuildRequires: python3-pytest
-BuildRequires: python3-pytest-cov
-BuildRequires: python3-pytest-runner
+BuildRequires: python3-Crypto
+BuildRequires: python3-ecdsa
+BuildRequires: python3-pytest >= 4.0.1
+BuildRequires: python3-pytest-cov >= 2.6.0
+BuildRequires: python3-pytest-runner >= 4.2
%endif
%endif
+# file and namespace conflict
+Conflicts: python-jwt
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -42,27 +51,40 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
A Python implementation of RFC 7519. Original implementation was
written by @progrium.
+%description -l pl.UTF-8
+Pythonowa implementacja RFC 7519. Oryginalna implementacja została
+napisana przez @progrium.
+
%package -n python3-%{module}
-Summary: JSON Web Token implementation in Python
+Summary: JSON Web Token implementation in Python 3
+Summary(pl.UTF-8): Implementacja JSON Web Token w Pythonie 3
+Group: Libraries/Python
Requires: python3-setuptools
+# file and namespace conflict
+Conflicts: python3-jwt
%description -n python3-%{module}
A Python implementation of RFC 7519. Original implementation was
written by @progrium.
+%description -n python3-%{module} -l pl.UTF-8
+Pythonowa implementacja RFC 7519. Oryginalna implementacja została
+napisana przez @progrium.
+
%prep
%setup -q -n PyJWT-%{version}
+%patch0 -p1
# Remove bundled egg-info
%{__rm} -r PyJWT.egg-info
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build %{?with_tests:pytest}
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build %{?with_tests:pytest}
%endif
%install
@@ -70,12 +92,12 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%py_install
%py_postclean
-mv $RPM_BUILD_ROOT%{_bindir}/jwt{,-2}
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/pyjwt{,-2}
%endif
%if %{with python3}
%py3_install
-mv $RPM_BUILD_ROOT%{_bindir}/jwt{,-3}
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/pyjwt{,-3}
%endif
%clean
@@ -84,8 +106,8 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc README.md LICENSE
-%attr(755,root,root) %{_bindir}/jwt-2
+%doc AUTHORS CHANGELOG.md LICENSE README.rst
+%attr(755,root,root) %{_bindir}/pyjwt-2
%{py_sitescriptdir}/jwt
%{py_sitescriptdir}/PyJWT-%{version}-py*.egg-info
%endif
@@ -93,8 +115,8 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-%doc README.md LICENSE
-%attr(755,root,root) %{_bindir}/jwt-3
+%doc AUTHORS CHANGELOG.md LICENSE README.rst
+%attr(755,root,root) %{_bindir}/pyjwt-3
%{py3_sitescriptdir}/jwt
%{py3_sitescriptdir}/PyJWT-%{version}-py*.egg-info
%endif
diff --git a/python-pyjwt-tests.patch b/python-pyjwt-tests.patch
new file mode 100644
index 0000000..d12fca0
--- /dev/null
+++ b/python-pyjwt-tests.patch
@@ -0,0 +1,29 @@
+--- PyJWT-1.7.1/setup.py.orig 2018-12-06 13:28:35.000000000 +0100
++++ PyJWT-1.7.1/setup.py 2021-01-20 21:48:02.372776650 +0100
+@@ -33,9 +33,9 @@
+ sys.exit()
+
+ tests_require = [
+- 'pytest>=4.0.1,<5.0.0',
+- 'pytest-cov>=2.6.0,<3.0.0',
+- 'pytest-runner>=4.2,<5.0.0',
++ 'pytest>=4.0.1',
++ 'pytest-cov>=2.6.0',
++ 'pytest-runner>=4.2',
+ ]
+
+ needs_pytest = set(('pytest', 'test', 'ptr')).intersection(sys.argv)
+--- PyJWT-1.7.1/tests/contrib/test_algorithms.py.orig 2018-11-26 04:04:17.000000000 +0100
++++ PyJWT-1.7.1/tests/contrib/test_algorithms.py 2021-01-20 21:47:38.742904664 +0100
+@@ -161,7 +161,10 @@
+ with open(key_path('testkey_ec.pub'), 'r') as keyfile:
+ jwt_pub_key = algo.prepare_key(keyfile.read())
+
+- result = algo.verify(jwt_message, jwt_pub_key, jwt_sig)
++ try:
++ result = algo.verify(jwt_message, jwt_pub_key, jwt_sig)
++ except: # ecdsa>=0.14 raises BadSignatureError
++ result = False
+ assert not result
+
+ def test_ec_verify_should_return_true_if_signature_valid(self):
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-pyjwt.git/commitdiff/d749d6e407f9e73e3e6b3fc3fee8d31ffd7de5b2
More information about the pld-cvs-commit
mailing list