14
0
forked from pool/python-PyJWT

Accepting request 491801 from home:xenonpk:python

Proper fix for tests with different python versions

OBS-URL: https://build.opensuse.org/request/show/491801
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-PyJWT?expand=0&rev=23
This commit is contained in:
2017-04-28 10:52:39 +00:00
committed by Git OBS Bridge
parent 540039ae0a
commit a0fb0b9056
3 changed files with 47 additions and 33 deletions

7
_service Normal file
View File

@@ -0,0 +1,7 @@
<services>
<service name="download_files" mode="localonly">
<param name="enforceupstream">yes</param>
<param name="changesgenerate">enable</param>
</service>
<service name="set_version" mode="localonly"/>
</services>

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Wed Apr 26 18:03:53 UTC 2017 - pousaduarte@gmail.com
- Convert to singlespec
- Remove unneeded dependency python-ecdsa
- Use "download_files" in _service file to automate source fetching
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Mar 17 18:58:52 UTC 2017 - rjschwei@suse.com Fri Mar 17 18:58:52 UTC 2017 - rjschwei@suse.com

View File

@@ -16,11 +16,7 @@
# #
%if 0%{?suse_version} && 0%{?suse_version} <= 1110 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
Name: python-PyJWT Name: python-PyJWT
Version: 1.4.2 Version: 1.4.2
Release: 0 Release: 0
@@ -29,19 +25,27 @@ License: MIT
Group: Development/Languages/Python Group: Development/Languages/Python
Url: https://github.com/progrium/pyjwt Url: https://github.com/progrium/pyjwt
Source: https://files.pythonhosted.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: %{python_module cryptography}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pytest-cov >= 1.7}
BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: dos2unix BuildRequires: dos2unix
BuildRequires: python-cryptography BuildRequires: fdupes
BuildRequires: python-devel BuildRequires: python-rpm-macros
BuildRequires: python-ecdsa
BuildRequires: python-pytest
BuildRequires: python-pytest-cov >= 1.7
BuildRequires: python-pytest-runner
BuildRequires: python-setuptools
Requires: python-cryptography Requires: python-cryptography
Requires: python-ecdsa Requires: python-setuptools
Requires(post): update-alternatives Requires(post): update-alternatives
Requires(postun): update-alternatives Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%python_subpackages
%description %description
A Python implementation of JSON Web Token draft 01. A Python implementation of JSON Web Token draft 01.
@@ -49,36 +53,32 @@ A Python implementation of JSON Web Token draft 01.
%prep %prep
%setup -q -n PyJWT-%{version} %setup -q -n PyJWT-%{version}
dos2unix jwt/__main__.py dos2unix jwt/__main__.py
sed -i -e "s/jwt = jwt.__main__:main/jwt-%{py_ver} = jwt.__main__:main/" setup.py
%build %build
python setup.py build %python_build
#remove shebang from all non executable files
find ./ -type f -name "*.py" -perm 644 -exec sed -i -e '1{\@^#!/usr/bin/env python@d}' {} \;
%install %install
python setup.py install --prefix=%{_prefix} --root=%{buildroot} %python_install
%python_clone -a %{buildroot}%{_bindir}/jwt
mkdir -p %{buildroot}%{_sysconfdir}/alternatives #hardlink duplicated files
touch %{buildroot}%{_sysconfdir}/alternatives/jwt %fdupes %{buildroot}
ln -sf %{_sysconfdir}/alternatives/jwt %{buildroot}/%{_bindir}/jwt
%post %post
update-alternatives \ %python_install_alternative jwt
--install %{_bindir}/jwt jwt %{_bindir}/jwt-%{py_ver} 30
%postun %postun
if [ $1 -eq 0 ] ; then %python_uninstall_alternative jwt
update-alternatives --remove jwt %{_bindir}/jwt-%{py_ver}
fi
%check %check
PYTHONPATH=%{buildroot}%{python_sitelib} py.test -k "not test_verify_false_deprecated" %{python_expand PYTHONPATH=%{buildroot}%{python_sitelib} py.test-%{py_ver} -k "not test_verify_false_deprecated" }
%files %files %python_files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc AUTHORS CHANGELOG.md LICENSE README.md %doc AUTHORS CHANGELOG.md LICENSE README.md
%{python_sitelib}/* %{python_sitelib}/*
%{_bindir}/jwt %python_alternative %{_bindir}/jwt
%{_bindir}/jwt-%{py_ver}
%ghost %{_sysconfdir}/alternatives/jwt
%changelog %changelog