]>
Commit | Line | Data |
---|---|---|
afd691c4 | 1 | # NOTE: for versions >= 2.0.0 (for python 3.6+) see python3-pyjwt.spec |
f455e9d6 ER |
2 | # |
3 | # Conditional build: | |
d749d6e4 | 4 | %bcond_with tests # unit tests |
f455e9d6 | 5 | %bcond_without python2 # CPython 2.x module |
afd691c4 | 6 | %bcond_with python3 # CPython 3.x module (built from python3-pyjwt.spec) |
f455e9d6 ER |
7 | |
8 | %define module pyjwt | |
d749d6e4 JB |
9 | Summary: JSON Web Token implementation in Python 2 |
10 | Summary(pl.UTF-8): Implementacja JSON Web Token w Pythonie 2 | |
f455e9d6 | 11 | Name: python-%{module} |
d749d6e4 JB |
12 | # keep 1.x here for python2 support |
13 | Version: 1.7.1 | |
c949f3c1 | 14 | Release: 2 |
f455e9d6 ER |
15 | License: MIT |
16 | Group: Libraries/Python | |
d749d6e4 | 17 | #Source0Download: https://pypi.org/simple/pyjwt/ |
f455e9d6 | 18 | Source0: https://files.pythonhosted.org/packages/source/P/PyJWT/PyJWT-%{version}.tar.gz |
d749d6e4 JB |
19 | # Source0-md5: a4712f980c008696e13e09504120b2a0 |
20 | Patch0: %{name}-tests.patch | |
f455e9d6 ER |
21 | URL: http://github.com/jpadilla/pyjwt |
22 | BuildRequires: rpm-pythonprov | |
23 | BuildRequires: rpmbuild(macros) >= 1.714 | |
24 | %if %{with python2} | |
d749d6e4 | 25 | BuildRequires: python-modules >= 1:2.7 |
f455e9d6 ER |
26 | BuildRequires: python-setuptools |
27 | %if %{with tests} | |
d749d6e4 JB |
28 | BuildRequires: python-Crypto |
29 | BuildRequires: python-ecdsa | |
30 | BuildRequires: python-pytest >= 4.0.1 | |
31 | BuildRequires: python-pytest-cov >= 2.6.0 | |
32 | BuildRequires: python-pytest-runner >= 4.2 | |
f455e9d6 ER |
33 | %endif |
34 | %endif | |
35 | %if %{with python3} | |
d749d6e4 | 36 | BuildRequires: python3-modules >= 1:3.4 |
f455e9d6 ER |
37 | BuildRequires: python3-setuptools |
38 | %if %{with tests} | |
d749d6e4 JB |
39 | BuildRequires: python3-Crypto |
40 | BuildRequires: python3-ecdsa | |
41 | BuildRequires: python3-pytest >= 4.0.1 | |
42 | BuildRequires: python3-pytest-cov >= 2.6.0 | |
43 | BuildRequires: python3-pytest-runner >= 4.2 | |
f455e9d6 ER |
44 | %endif |
45 | %endif | |
d749d6e4 JB |
46 | # file and namespace conflict |
47 | Conflicts: python-jwt | |
f455e9d6 ER |
48 | BuildArch: noarch |
49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
50 | ||
51 | %description | |
52 | A Python implementation of RFC 7519. Original implementation was | |
53 | written by @progrium. | |
54 | ||
d749d6e4 JB |
55 | %description -l pl.UTF-8 |
56 | Pythonowa implementacja RFC 7519. Oryginalna implementacja została | |
57 | napisana przez @progrium. | |
58 | ||
f455e9d6 | 59 | %package -n python3-%{module} |
d749d6e4 JB |
60 | Summary: JSON Web Token implementation in Python 3 |
61 | Summary(pl.UTF-8): Implementacja JSON Web Token w Pythonie 3 | |
62 | Group: Libraries/Python | |
f455e9d6 | 63 | Requires: python3-setuptools |
d749d6e4 JB |
64 | # file and namespace conflict |
65 | Conflicts: python3-jwt | |
f455e9d6 ER |
66 | |
67 | %description -n python3-%{module} | |
68 | A Python implementation of RFC 7519. Original implementation was | |
69 | written by @progrium. | |
70 | ||
d749d6e4 JB |
71 | %description -n python3-%{module} -l pl.UTF-8 |
72 | Pythonowa implementacja RFC 7519. Oryginalna implementacja została | |
73 | napisana przez @progrium. | |
74 | ||
f455e9d6 ER |
75 | %prep |
76 | %setup -q -n PyJWT-%{version} | |
d749d6e4 | 77 | %patch0 -p1 |
f455e9d6 ER |
78 | |
79 | # Remove bundled egg-info | |
80 | %{__rm} -r PyJWT.egg-info | |
81 | ||
82 | %build | |
83 | %if %{with python2} | |
d749d6e4 | 84 | %py_build %{?with_tests:pytest} |
f455e9d6 ER |
85 | %endif |
86 | ||
87 | %if %{with python3} | |
d749d6e4 | 88 | %py3_build %{?with_tests:pytest} |
f455e9d6 ER |
89 | %endif |
90 | ||
91 | %install | |
92 | rm -rf $RPM_BUILD_ROOT | |
93 | %if %{with python2} | |
94 | %py_install | |
95 | %py_postclean | |
d749d6e4 | 96 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pyjwt{,-2} |
f455e9d6 ER |
97 | %endif |
98 | ||
99 | %if %{with python3} | |
100 | %py3_install | |
d749d6e4 | 101 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pyjwt{,-3} |
f455e9d6 ER |
102 | %endif |
103 | ||
104 | %clean | |
105 | rm -rf $RPM_BUILD_ROOT | |
106 | ||
107 | %if %{with python2} | |
108 | %files | |
109 | %defattr(644,root,root,755) | |
d749d6e4 JB |
110 | %doc AUTHORS CHANGELOG.md LICENSE README.rst |
111 | %attr(755,root,root) %{_bindir}/pyjwt-2 | |
f455e9d6 ER |
112 | %{py_sitescriptdir}/jwt |
113 | %{py_sitescriptdir}/PyJWT-%{version}-py*.egg-info | |
114 | %endif | |
115 | ||
116 | %if %{with python3} | |
117 | %files -n python3-%{module} | |
118 | %defattr(644,root,root,755) | |
d749d6e4 JB |
119 | %doc AUTHORS CHANGELOG.md LICENSE README.rst |
120 | %attr(755,root,root) %{_bindir}/pyjwt-3 | |
f455e9d6 ER |
121 | %{py3_sitescriptdir}/jwt |
122 | %{py3_sitescriptdir}/PyJWT-%{version}-py*.egg-info | |
123 | %endif |