## START: Set by rpmautospec ## (rpmautospec version 0.2.6) %define autorelease(e:s:pb:) %{?-p:0.}%{lua: release_number = 16; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{?dist} ## END: Set by rpmautospec # Sphinx-generated HTML documentation is not suitable for packaging; see # https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion. # # We can generate PDF documentation as a substitute. %bcond_without doc_pdf Name: python-jose Version: 3.3.0 Release: %autorelease Summary: A JOSE implementation in Python # SPDX License: MIT URL: https://github.com/mpdavis/python-jose Source0: %{pypi_source python-jose} BuildArch: noarch BuildRequires: python3-devel # From setup_requires: BuildRequires: python3dist(pytest-runner) # Documentation %if %{with doc_pdf} BuildRequires: make # From requirements-rtd.txt: # sphinxcontrib-napoleon==0.3.4; but napoleon is now part of Sphinx proper BuildRequires: python3dist(sphinx) BuildRequires: python3-sphinx-latex BuildRequires: latexmk BuildRequires: tex-xetex-bin %endif # Fedora packages pycryptodomex, but not pycryptodome (which conflicts with # pycrypto). Upstream refuses to switch to pycryptodomex for the pycryptodome # backend (https://github.com/mpdavis/python-jose/issues/26), so we disable the # corresponding extra because it will fail to install. # # We also obsolete the old backend subpackage that required pycryptodomex, # because it did not do what it claimed to do. %if 0%{?fedora} != 0 && 0%{?fedora} < 38 Obsoletes: python3-jose-pycryptodome < 3.2.0-3 %endif # Upstream release 3.3.0, first packaged in Fedora 35, dropped the pycrypto # backend, so we obsolete the corresponding extra. The conditional reminds us # when the Obsoletes can be removed from the spec file. %if 0%{?fedora} != 0 && 0%{?fedora} < 38 Obsoletes: python3-jose+pycrypto < 3.3.0-1 %endif # Upstream recommends the cryptography backend. We add it as a soft dependency # so that anyone who does not go out of their way to select a different backend # gets the best experience. Recommends: python3dist(python-jose[cryptography]) %global common_description %{expand: The JavaScript Object Signing and Encryption (JOSE) technologies - JSON Web Signature (JWS), JSON Web Encryption (JWE), JSON Web Key (JWK), and JSON Web Algorithms (JWA) - collectively can be used to encrypt and/or sign content using a variety of algorithms. While the full set of permutations is extremely large, and might be daunting to some, it is expected that most applications will only use a small set of algorithms to meet their needs. As of 3.3.0, python-jose implements three different cryptographic backends. The backend must be selected as an extra when installing python-jose. If you do not select a backend, the native-python backend will be installed. Unless otherwise noted, all backends support all operations. Due to complexities with setuptools, the native-python backend is always installed, even if you select a different backend on install. 1. cryptography * This backend uses pyca/cryptography for all cryptographic operations. This is the recommended backend and is selected over all other backends if any others are present. * Installation: dnf install python3-jose+cryptography * Unused dependencies: - rsa - ecdsa - pyasn1 2. pycryptodome * This backend uses pycryptodome for all cryptographic operations. * Installation: not available because pycryptodome (which, unlike pycryptodomex, conflicts with pycrypto) is not packaged * Unused dependencies: - rsa 3. native-python * This backend uses python-rsa and python-ecdsa for all cryptographic operations. This backend is always installed but any other backend will take precedence if one is installed. * Installation: dnf install python3-jose Note The native-python backend cannot process certificates.} %description %{common_description} %package -n python3-jose Summary: %{summary} %description -n python3-jose %{common_description} %package doc Summary: Documentation for python-jose %description doc %{common_description} # We use the expansion of (on a single line): # # %%python_extras_subpkg -n python3-jose # -i %%{python3_sitelib}/*.dist-info cryptography # # but add Provides/Obsoletes for the old backend subpackages. %package -n python3-jose+cryptography Summary: Metapackage for python3-jose: cryptography extras Requires: python3-jose = %{version}-%{release} %if 0%{?fedora} != 0 && 0%{?fedora} < 38 Provides: python3-jose-cryptography = %{version}-%{release} Obsoletes: python3-jose-cryptography < 3.2.0-3 %endif %description -n python3-jose+cryptography This is a metapackage bringing in cryptography extras requires for python3-jose. It contains no code, just makes sure the dependencies are installed. %files -n python3-jose+cryptography %ghost %{python3_sitelib}/*.dist-info %prep %autosetup -p1 # Patch out pycryptodome backend extra and tests where required; see note near # the BR’s sed -r -i '/^[[:blank:]]*pycryptodome/d' tox.ini requirements.txt # The napoleon extension is now part of Sphinx proper: sed -r -i 's/(sphinx)contrib(\.napoleon)/\1.ext\2/g' docs/conf.py # Patch out unnecessary coverage dependencies: sed -r -i '/pytest-cov/d' tox.ini %generate_buildrequires %pyproject_buildrequires -t -x cryptography %build %pyproject_wheel %if %{with doc_pdf} %make_build -C docs latex SPHINXOPTS='%{?_smp_mflags}' %make_build -C docs/_build/latex LATEXMKOPTS='-quiet' %endif %install %pyproject_install %pyproject_save_files jose %check echo '>>> Backend: native-python <<<' 1>&2 m='not (cryptography or pycryptodome or backend_compatibility)' %{pytest} -k "${k}" -m "${m}" tests echo '>>> Backend: cryptography <<<' 1>&2 m='not (pycryptodome or backend_compatibility)' %{pytest} -k "${k}" -m "${m}" tests echo '>>> Cross-backend compatibility and coexistence <<<' 1>&2 %{pytest} -k "${k}" tests %files -n python3-jose -f %{pyproject_files} %doc README.rst %files doc %license LICENSE %if %{with doc_pdf} %doc docs/_build/latex/python-jose.pdf %endif %changelog * Sat Oct 22 2022 Benjamin A. Beasley 3.3.0-16 - Confirm License is SPDX MIT * Fri Jul 22 2022 Fedora Release Engineering 3.3.0-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild * Tue Jun 14 2022 Python Maint 3.3.0-14 - Rebuilt for Python 3.11 * Fri Jan 21 2022 Fedora Release Engineering 3.3.0-13 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Fri Dec 17 2021 Benjamin A. Beasley 3.3.0-12 - Drop unnecessary pytest-cov dependency * Sat Nov 27 2021 Benjamin A. Beasley 3.3.0-11 - Reduce LaTeX PDF build verbosity * Thu Sep 30 2021 Benjamin A. Beasley 3.3.0-10 - Generate PDF instead of HTML Sphinx documentation. * Mon Sep 13 2021 Benjamin A. Beasley 3.3.0-9 - Let pyproject-rpm-macros handle the license file * Sun Sep 12 2021 Benjamin A. Beasley 3.3.0-8 - Reduce macro indirection in the spec file * Sun Sep 12 2021 Benjamin A. Beasley 3.3.0-7 - Drop BR on pyproject-rpm-macros, now implied by python3-devel * Sun Sep 12 2021 Benjamin A. Beasley 3.3.0-6 - Reduce spec file macro indirection * Tue Jul 27 2021 Benjamin A. Beasley 3.3.0-5 - Move %%generate_buildrequires after %%prep to make the spec file easier to follow * Fri Jul 23 2021 Fedora Release Engineering 3.3.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild * Wed Jul 21 2021 Benjamin A. Beasley 3.3.0-3 - Drop unused _summary macro * Sun Jun 06 2021 Benjamin A. Beasley - 3.3.0-1 - Update to 3.3.0 (fixes RHBZ#1968095) - Drop python-jose-3.2.0-pr-199.patch (backported ecdsa 0.16 support), now merged upstream - Upstream dropped pycypto backend; we drop the corresponding extra - Remove a comment referring to Fedora 32 since it is EOL - Stop removing egg-info/dist-info (not needed with pyproject-rpm-macros * Fri Jun 04 2021 Python Maint - 3.2.0-7 - Rebuilt for Python 3.10 * Sat Apr 10 2021 Benjamin A. Beasley - 3.2.0-6 - Drop Fedora 32 workarounds - Fix some remaining conditionals * Tue Mar 16 2021 Benjamin A. Beasley - 3.2.0-5 - Drop python3dist(setuptools) BR, redundant with %%pyproject_buildrequires * Fri Mar 05 2021 Benjamin A. Beasley - 3.2.0-4 - Backport unreleased ecdsa 0.16 support from upstream. Fixes TestECAlgorithm.test_key_too_short test. * Sat Feb 27 2021 Benjamin A. Beasley - 3.2.0-3 - Change “test_key_too_short” skip from patch to pytest option - Simplify use of name macros - Switch URL to HTTPS - Improved summaries and descriptions - After verifying no dependent packages use them, replace the ad-hoc backend metapackages with standard extras metapackages - Drop obsolete python_provide macro - Use %%pytest macro and print a message for each backend-specific test invocation - Whitespace changes - Remove explicit/manual Requires from main package - Use pyproject-rpm-macros, including generated BR’s - Fedora packages pycryptodomex, but not pycryptodome (which conflicts with pycrypto). Upstream refuses to switch to pycryptodomex for the pycryptodome backend (https://github.com/mpdavis/python-jose/issues/26), so we disable the corresponding extra because it will fail to install. - Add a soft dependency on the cryptography backend extra - Build the HTML documentation in a new -doc subpackage * Wed Jan 27 2021 Fedora Release Engineering - 3.2.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild * Mon Oct 5 23:59:32 -03 2020 Itamar Reis Peixoto - 3.2.0-1 - 3.2.0 * Wed Jul 29 2020 Fedora Release Engineering - 3.1.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild * Sun May 17 2020 Chenxiong Qi - 3.1.0-1 - Initial package.