From 3617aabf99d6575e210b98df6e6990c201c21476 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 1 Aug 2017 20:10:47 +0200 Subject: [PATCH] Modernize spec, provide python2-jwcrypto --- python-jwcrypto.spec | 83 ++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 33 deletions(-) diff --git a/python-jwcrypto.spec b/python-jwcrypto.spec index ebf3f4d..63077b6 100644 --- a/python-jwcrypto.spec +++ b/python-jwcrypto.spec @@ -2,88 +2,105 @@ %global with_python3 1 %endif -%define module_name jwcrypto +%global srcname jwcrypto -Name: python-jwcrypto +Name: python-%{srcname} Version: 0.4.2 -Release: 1%{?dist} -Summary: Implements JWK,JWS,JWE specifications using python-cryptography +Release: 2%{?dist} +Summary: Implements JWK, JWS, JWE specifications using python-cryptography License: LGPLv3+ -URL: https://github.com/latchset/%{module_name} -Source0: https://github.com/latchset/%{module_name}/releases/download/v%{version}/%{module_name}-%{version}.tar.gz +URL: https://github.com/latchset/%{srcname} +Source0: https://github.com/latchset/%{srcname}/releases/download/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python2-devel BuildRequires: python2-setuptools -BuildRequires: python2-cryptography +BuildRequires: python2-cryptography >= 1.5 BuildRequires: python2-pytest -Requires: python2-cryptography %if 0%{?with_python3} -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-cryptography -BuildRequires: python3-pytest +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-cryptography >= 1.5 +BuildRequires: python%{python3_pkgversion}-pytest %endif %description -Implements JWK,JWS,JWE specifications using python-cryptography +Implements JWK, JWS, JWE specifications using python-cryptography + + +%package -n python2-%{srcname} +Summary: Implements JWK,JWS,JWE specifications using python-cryptography +Requires: python2-cryptography >= 1.5 +%{?python_provide:%python_provide python2-%{srcname}} + +%description -n python2-%{srcname} +Implements JWK, JWS, JWE specifications using python-cryptography + %if 0%{?with_python3} -%package -n python3-jwcrypto -Summary: Implements JWK,JWS,JWE specifications using python3-cryptography -Requires: python3-cryptography +%package -n python%{python3_pkgversion}-%{srcname} +Summary: Implements JWK, JWS, JWE specifications using python-cryptography +Requires: python%{python3_pkgversion}-cryptography >= 1.5 +%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}} -%description -n python3-jwcrypto -Implements JWK,JWS,JWE specifications using python3-cryptography +%description -n python%{python3_pkgversion}-%{srcname} +Implements JWK, JWS, JWE specifications using python-cryptography %endif + %prep -%setup -q -n %{module_name}-%{version} +%setup -q -n %{srcname}-%{version} %build -%{__python2} setup.py build +%py2_build %if 0%{?with_python3} -%{__python3} setup.py build +%py3_build %endif %check -pytest-2 jwcrypto/test*.py +pytest-2 %{srcname}/test*.py %if 0%{?with_python3} -pytest-3 jwcrypto/test*.py +pytest-3 %{srcname}/test*.py %endif %install -%{__python2} setup.py install -O1 --skip-build --root %{buildroot} +%py2_install %if 0%{?with_python3} -%{__python3} setup.py install -O1 --skip-build --root %{buildroot} +%py3_install %endif -rm -rf %{buildroot}%{_docdir}/%{module_name} -rm -rf %{buildroot}%{python2_sitelib}/%{module_name}/tests{,-cookbook}.py* + +rm -rf %{buildroot}%{_docdir}/%{srcname} +rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/tests{,-cookbook}.py* %if 0%{?with_python3} -rm -rf %{buildroot}%{python3_sitelib}/%{module_name}/tests{,-cookbook}.py* -rm -rf %{buildroot}%{python3_sitelib}/%{module_name}/__pycache__/tests{,-cookbook}.*.py* +rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/tests{,-cookbook}.py* +rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/tests{,-cookbook}.*.py* %endif -%files +%files -n python2-%{srcname} %doc README.md %license LICENSE -%{python_sitelib}/* +%{python2_sitelib}/%{srcname} +%{python2_sitelib}/%{srcname}-%{version}-py%{python2_version}.egg-info %if 0%{?with_python3} -%files -n python3-jwcrypto +%files -n python%{python3_pkgversion}-%{srcname} %doc README.md %license LICENSE -%{python3_sitelib}/* +%{python3_sitelib}/%{srcname} +%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info %endif %changelog +* Tue Aug 01 2017 Christian Heimes - 0.4.2-2 +- Modernize spec + * Tue Aug 01 2017 Christian Heimes - 0.4.2-1 - Upstream release 0.4.2 - Resolves: RHBZ #1476150