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