diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..94ac94f
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,4 @@
+
+ test-backend-cryptography
+ test-backend-native
+
diff --git a/python-jose-3.2.0.tar.gz b/python-jose-3.2.0.tar.gz
deleted file mode 100644
index 29278ce..0000000
--- a/python-jose-3.2.0.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:2bcdae15bef4bc22c35edae9bda0fec1c42769e96cef680c76e165ac5bbf3cd5
-size 102183
diff --git a/python-jose-3.3.0.tar.gz b/python-jose-3.3.0.tar.gz
new file mode 100644
index 0000000..8459b6e
--- /dev/null
+++ b/python-jose-3.3.0.tar.gz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:55779b5e6ad599c6336191246e95eb2293a9ddebd555f796a65f838f07e5d78a
+size 129068
diff --git a/python-python-jose.changes b/python-python-jose.changes
index 245f3f8..81e178a 100644
--- a/python-python-jose.changes
+++ b/python-python-jose.changes
@@ -1,3 +1,19 @@
+-------------------------------------------------------------------
+Sun May 29 19:45:02 UTC 2022 - Ben Greiner
+
+- Update to 3.3.0
+ * Remove support for python 2.7 & 3.5
+ * Add support for Python 3.9
+ * Remove PyCrypto backend
+ * Fix deprecation warning from cryptography backend
+- Add rpm subpackages for the extra backend selection. The missing
+ requires were only discovered because other packages started to
+ fail.
+ * setup.py and README still mention pycrypto and pycryptodome, but
+ it was removed from the code.
+ * Test in flavors
+- Refresh unpin-deps.patch
+
-------------------------------------------------------------------
Wed Aug 5 12:58:25 UTC 2020 - Marketa Calabkova
diff --git a/python-python-jose.spec b/python-python-jose.spec
index 249f32e..adb6db9 100644
--- a/python-python-jose.spec
+++ b/python-python-jose.spec
@@ -1,7 +1,7 @@
#
-# spec file for package python-python-jose
+# spec file
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -16,29 +16,52 @@
#
-%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-Name: python-python-jose
-Version: 3.2.0
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test-backend-cryptography"
+%define psuffix -%{flavor}
+%bcond_without test
+%bcond_without testcryptography
+%bcond_with testnative
+%endif
+%if "%{flavor}" == "test-backend-native"
+%define psuffix -%{flavor}
+%bcond_without test
+%bcond_with testcryptography
+%bcond_without testnative
+%endif
+%if "%{flavor}" == ""
+%define psuffix %{nil}
+%bcond_with test
+%bcond_with testcryptography
+%bcond_with testnative
+%endif
+
+%{?!python_module:%define python_module() python3-%{**}}
+%define skip_python2 1
+Name: python-python-jose%{psuffix}
+Version: 3.3.0
Release: 0
Summary: JOSE implementation in Python
License: MIT
URL: https://github.com/mpdavis/python-jose
-Source: https://github.com/mpdavis/python-jose/archive/%{version}.tar.gz#/python-jose-%{version}.tar.gz
+Source: https://files.pythonhosted.org/packages/source/p/python-jose/python-jose-%{version}.tar.gz
Patch0: unpin-deps.patch
BuildRequires: %{python_module setuptools >= 39.2.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
-Requires: python-six
-Recommends: python-cryptography
-Recommends: python-pyasn1
-Recommends: python-pycryptodome >= 3.3.1
+Requires: python-ecdsa >= 0.16
+Requires: python-pyasn1
+Requires: python-rsa
BuildArch: noarch
-# SECTION test requirements
-BuildRequires: %{python_module cryptography}
-BuildRequires: %{python_module pyasn1}
-BuildRequires: %{python_module pycryptodome >= 3.3.1}
+%if %{with test}
BuildRequires: %{python_module pytest}
-BuildRequires: %{python_module six}
+%if %{with testcryptography}
+BuildRequires: %{python_module python-jose-cryptography = %{version}}
+%endif
+%if %{with testnative}
+BuildRequires: %{python_module python-jose = %{version}}
+%endif
+%endif
# /SECTION
%python_subpackages
@@ -46,25 +69,51 @@ BuildRequires: %{python_module six}
A JavaScript Object Signing and Encryption (JOSE) technologies
implementation in Python.
-%prep
-%setup -q -n python-jose-%{version}
-%patch0 -p1
-sed -i -e '/addopts/d' setup.cfg
-sed -i -e '/pytest-runner/d' setup.py
+python-jose implements different cryptographic backends.
+Consuming python packages must select the backend as an extra
+when installing python-jose. RPM packages must select the
+corresponding rpm subpackage. If no backend is selected, the
+main package uses the native-python backend.
+%package cryptography
+Summary: JOSE implementation in Python, cryptography extra
+Requires: %{name} = %{version}-%{release}
+Requires: python-cryptography >= 3.4.0
+
+%description cryptography
+A JavaScript Object Signing and Encryption (JOSE) technologies
+implementation in Python.
+
+python-jose implements three different cryptographic backends.
+This package provides the python-jose[cryptography] extra.
+
+%prep
+%autosetup -p1 -n python-jose-%{version}
+
+%if ! %{with test}
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
+%endif
+%if %{with test}
%check
-%pytest
+%pytest -rsEf
+%endif
+%if ! %{with test}
%files %{python_files}
%doc README.rst
%license LICENSE
-%{python_sitelib}/*
+%{python_sitelib}/python_jose-%{version}*-info
+%{python_sitelib}/jose
+
+%files %{python_files cryptography}
+%doc README.rst
+%license LICENSE
+%endif
%changelog
diff --git a/unpin-deps.patch b/unpin-deps.patch
index 6f62409..dfdd82d 100644
--- a/unpin-deps.patch
+++ b/unpin-deps.patch
@@ -1,20 +1,32 @@
-Index: python-jose-3.2.0/setup.py
+Index: python-jose-3.3.0/setup.py
===================================================================
---- python-jose-3.2.0.orig/setup.py
-+++ python-jose-3.2.0/setup.py
-@@ -35,11 +35,11 @@ def _cryptography_version():
- pyasn1 = ['pyasn1']
+--- python-jose-3.3.0.orig/setup.py
++++ python-jose-3.3.0/setup.py
+@@ -23,11 +23,9 @@ def get_packages(package):
+ pyasn1 = ["pyasn1"]
extras_require = {
- 'cryptography': [_cryptography_version()],
-- 'pycrypto': ['pycrypto >=2.6.0, <2.7.0'] + pyasn1,
-- 'pycryptodome': ['pycryptodome >=3.3.1, <4.0.0'] + pyasn1,
-+ 'pycrypto': ['pycrypto >=2.6.0'] + pyasn1,
-+ 'pycryptodome': ['pycryptodome >=3.3.1'] + pyasn1,
+ "cryptography": ["cryptography>=3.4.0"],
+- "pycrypto": ["pycrypto >=2.6.0, <2.7.0"] + pyasn1,
+- "pycryptodome": ["pycryptodome >=3.3.1, <4.0.0"] + pyasn1,
}
--legacy_backend_requires = ['ecdsa <0.15', 'rsa'] + pyasn1
--install_requires = ['six <2.0']
-+legacy_backend_requires = ['ecdsa', 'rsa'] + pyasn1
-+install_requires = ['six']
-
# TODO: work this into the extras selection instead.
- install_requires += legacy_backend_requires
+-install_requires = ["ecdsa != 0.15", "rsa"] + pyasn1
++install_requires = ["ecdsa >= 0.16", "rsa"] + pyasn1
+
+
+ setup(
+@@ -63,14 +61,11 @@ setup(
+ ],
+ extras_require=extras_require,
+ setup_requires=[
+- "pytest-runner",
+ "setuptools>=39.2.0",
+ ],
+ tests_require=[
+ "ecdsa != 0.15",
+ "pytest",
+- "pytest-cov",
+- "pytest-runner",
+ ],
+ install_requires=install_requires,
+ )