4b28bb
%{!?__python2: %global __python2 /usr/bin/python2}
4b28bb
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
4b28bb
4b28bb
%if 0%{?fedora}
4b28bb
%global with_python3 1
4b28bb
%endif
4b28bb
4b28bb
%define module_name jwcrypto
4b28bb
4b28bb
Name:           python-jwcrypto
ba8796
Version:        0.4.2
4b28bb
Release:        1%{?dist}
4b28bb
Summary:        Implements JWK,JWS,JWE specifications using python-cryptography
4b28bb
4b28bb
License:        LGPLv3+
ba8796
URL:            https://github.com/latchset/%{module_name}
ba8796
Source0:        https://github.com/latchset/%{module_name}/releases/download/v%{version}/jwcrypto-%{version}.tar.gz
ba8796
Source1:        https://github.com/latchset/%{module_name}/releases/download/v%{version}/jwcrypto-%{version}.tar.gz.sha512sum.txt
4b28bb
4b28bb
BuildArch:      noarch
4b28bb
BuildRequires:  python-devel
4b28bb
BuildRequires:  python-setuptools
ba8796
BuildRequires:  python-cryptography >= 1.5
4b28bb
BuildRequires:  pytest
ba8796
Requires:       python-cryptography >= 1.5
4b28bb
4b28bb
%if 0%{?with_python3}
4b28bb
BuildRequires:      python3-devel
4b28bb
BuildRequires:      python3-setuptools
ba8796
BuildRequires:      python3-cryptography >= 1.5
4b28bb
BuildRequires:      python3-pytest
4b28bb
%endif
4b28bb
4b28bb
%description
4b28bb
Implements JWK,JWS,JWE specifications using python-cryptography
4b28bb
4b28bb
%if 0%{?with_python3}
4b28bb
%package -n python3-jwcrypto
4b28bb
Summary:            Implements JWK,JWS,JWE specifications using python3-cryptography
4b28bb
Requires:           python3-cryptography
4b28bb
4b28bb
%description -n python3-jwcrypto
4b28bb
Implements JWK,JWS,JWE specifications using python3-cryptography
4b28bb
%endif
4b28bb
4b28bb
%prep
4b28bb
grep `sha512sum %{SOURCE0}` %{SOURCE1} || (echo "Checksum invalid!" && exit 1)
4b28bb
%setup -q -n %{module_name}-%{version}
4b28bb
4b28bb
4b28bb
%build
4b28bb
%{__python2} setup.py build
4b28bb
%if 0%{?with_python3}
4b28bb
%{__python3} setup.py build
4b28bb
%endif
4b28bb
4b28bb
4b28bb
%install
4b28bb
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
4b28bb
%if 0%{?with_python3}
4b28bb
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
4b28bb
%endif
4b28bb
rm -rf %{buildroot}%{_docdir}/%{module_name}
4b28bb
rm -rf %{buildroot}%{python2_sitelib}/%{module_name}/tests{,-cookbook}.py*
4b28bb
%if 0%{?with_python3}
4b28bb
rm -rf %{buildroot}%{python3_sitelib}/%{module_name}/tests{,-cookbook}.py*
4b28bb
rm -rf %{buildroot}%{python3_sitelib}/%{module_name}/__pycache__/tests{,-cookbook}.*.py*
4b28bb
%endif
4b28bb
4b28bb
4b28bb
%check
4b28bb
%{__python2} -m py.test -vv ./%{module_name}/tests{,-cookbook}.py
4b28bb
%if 0%{?with_python3}
4b28bb
%{__python3} -m py.test -vv ./%{module_name}/tests{,-cookbook}.py
4b28bb
%endif
4b28bb
4b28bb
4b28bb
%files
4b28bb
%doc README.md
4b28bb
%license LICENSE
4b28bb
%{python2_sitelib}/%{module_name}
4b28bb
%{python2_sitelib}/%{module_name}-*.egg-info
4b28bb
4b28bb
%if 0%{?with_python3}
4b28bb
%files -n python3-jwcrypto
4b28bb
%doc README.md
4b28bb
%license LICENSE
4b28bb
%{python3_sitelib}/%{module_name}
4b28bb
%{python3_sitelib}/%{module_name}-*.egg-info
4b28bb
%endif
4b28bb
4b28bb
4b28bb
%changelog
ba8796
* Thu Aug 17 2017 Christian Heimes <cheimes@redhat.com> - 0.4.2-1
ba8796
- Rebase to 0.4.2, resolves rhbz#1434409
ba8796
ba8796
* Mon Apr 04 2016 Christian Heimes <cheimes@redhat.com> - 0.2.1-2
ba8796
- Correct download link
ba8796
4b28bb
* Thu Mar 31 2016 Christian Heimes <cheimes@redhat.com> - 0.2.1-1
4b28bb
- Initial packaging