Modernize spec and make sure to provide python2-jwt

This commit is contained in:
Kevin Fenzi 2017-04-17 09:28:00 -06:00
parent b89ba7afce
commit 07454907d7
2 changed files with 53 additions and 50 deletions

12
allow-newer-pytest.patch Normal file
View File

@ -0,0 +1,12 @@
diff -Nur PyJWT-1.4.2.orig/setup.py PyJWT-1.4.2/setup.py
--- PyJWT-1.4.2.orig/setup.py 2016-06-29 22:07:44.000000000 -0600
+++ PyJWT-1.4.2/setup.py 2017-04-17 09:05:19.783324336 -0600
@@ -30,7 +30,7 @@
sys.exit()
tests_require = [
- 'pytest==2.7.3',
+ 'pytest',
'pytest-cov',
'pytest-runner',
]

View File

@ -2,35 +2,30 @@
%global with_python3 1 %global with_python3 1
%endif %endif
# Use the same directory of the main package for subpackage licence and docs %global srcname jwt
%global _docdir_fmt %{name} %global sum JSON Web Token implementation in Python
%{!?_licensedir: %global license %%doc}
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%global modname jwt
Name: python-jwt Name: python-jwt
Version: 1.4.2 Version: 1.4.2
Release: 3%{?dist} Release: 4%{?dist}
Summary: JSON Web Token implementation in Python Summary: %{sum}
Group: Development/Libraries Group: Development/Libraries
License: MIT License: MIT
URL: http://pypi.python.org/pypi/pyjwt URL: http://pypi.python.org/pypi/pyjwt
Source0: https://pypi.python.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz Source0: https://pypi.python.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz
#
# Upstream hard coded a specific version of pytest to avoid a bug
# However, that bug is long since fixed upstream
#
Patch0: allow-newer-pytest.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
BuildRequires: python-cryptography BuildRequires: python-cryptography
Requires: python-cryptography
BuildRequires: pytest BuildRequires: python2-pytest
BuildRequires: python-pytest-cov BuildRequires: python-pytest-cov
BuildRequires: python-pytest-runner BuildRequires: python-pytest-runner
@ -50,13 +45,24 @@ means of representing signed content using JSON data structures, including
claims to be transferred between two parties encoded as digitally signed and claims to be transferred between two parties encoded as digitally signed and
encrypted JSON objects. encrypted JSON objects.
%if 0%{?with_python3} %package -n python2-%{srcname}
%package -n python3-jwt Summary: %{sum}
Summary: JSON Web Token implementation in Python Requires: python-cryptography
Group: Development/Libraries %{?python_provide:%python_provide python2-%{srcname}}
Requires: python3-cryptography
%description -n python3-jwt %description -n python2-%{srcname}
A Python implementation of JSON Web Token draft 01. This library provides a
means of representing signed content using JSON data structures, including
claims to be transferred between two parties encoded as digitally signed and
encrypted JSON objects.
%if 0%{?with_python3}
%package -n python3-%{srcname}
Summary: %{sum}
%{?python_provide:%python_provide python3-%{srcname}}
Requires: python3-cryptography
%description -n python3-%{srcname}
A Python3 implementation of JSON Web Token draft 01. This library provides a A Python3 implementation of JSON Web Token draft 01. This library provides a
means of representing signed content using JSON data structures, including means of representing signed content using JSON data structures, including
claims to be transferred between two parties encoded as digitally signed and claims to be transferred between two parties encoded as digitally signed and
@ -64,60 +70,45 @@ encrypted JSON objects.
%endif %endif
%prep %prep
%setup -q -n PyJWT-%{version} %autosetup -n PyJWT-%{version}
# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info
find . -name "*.pyc" -exec rm -rf {} \; || echo;
find . -name "__pycache__" -exec rm -rf {} \; || echo;
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build %build
%{__python2} setup.py build %py2_build
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %py3_build
%{__python3} setup.py build
popd
%endif %endif
%install %install
%py2_install
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %py3_install
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
mv %{buildroot}%{_bindir}/jwt %{buildroot}%{_bindir}/python3-jwt
popd
%endif %endif
%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}
%check %check
py.test . %{__python2} setup.py test
%if 0%{?with_python3} %if 0%{?with_python3}
pushd %{py3dir} %{__python3} setup.py test
py.test-%{python3_version} .
popd
%endif %endif
%files %files -n python2-jwt
%doc README.md AUTHORS %doc README.md AUTHORS
%license LICENSE %license LICENSE
%{python2_sitelib}/%{modname}/ %{python2_sitelib}/%{srcname}/
%{python2_sitelib}/PyJWT-%{version}* %{python2_sitelib}/PyJWT-%{version}*
%{_bindir}/jwt
%if 0%{?with_python3} %if 0%{?with_python3}
%files -n python3-jwt %files -n python3-jwt
%doc README.md AUTHORS %doc README.md AUTHORS
%license LICENSE %license LICENSE
%{python3_sitelib}/%{modname}/ %{python3_sitelib}/%{srcname}/
%{python3_sitelib}/PyJWT-%{version}* %{python3_sitelib}/PyJWT-%{version}*
%{_bindir}/python3-jwt %{_bindir}/jwt
%endif %endif
%changelog %changelog
* Mon Apr 17 2017 Kevin Fenzi <kevin@scrye.com> - 1.4.2-4
- Modernize spec and make sure to provide python2-jwt
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.2-3 * Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild