]>
Commit | Line | Data |
---|---|---|
0c903547 ER |
1 | # |
2 | # Conditional build: | |
cbd125fb JB |
3 | %bcond_without doc # Sphinx documentation |
4 | %bcond_with tests # unit tests (some failing as of 0.9.1) | |
0c903547 ER |
5 | %bcond_without python2 # CPython 2.x module |
6 | %bcond_without python3 # CPython 3.x module | |
7 | ||
8 | %define module requests_toolbelt | |
9 | %define egg_name requests_toolbelt | |
10 | %define pypi_name requests-toolbelt | |
11 | Summary: Utility belt for advanced users of python-requests | |
cbd125fb | 12 | Summary(pl.UTF-8): Pasek narzędzi dla zaawansowanych użytkowników python-requests |
0c903547 | 13 | Name: python-%{pypi_name} |
cbd125fb | 14 | Version: 0.9.1 |
0d165cce | 15 | Release: 2 |
0c903547 ER |
16 | License: Apache v2.0 |
17 | Group: Libraries/Python | |
cbd125fb JB |
18 | #Source0Download: https://pypi.org/simple/requests-toolbelt/ |
19 | Source0: https://files.pythonhosted.org/packages/source/r/requests-toolbelt/%{pypi_name}-%{version}.tar.gz | |
20 | # Source0-md5: b1509735c4b4cf95df2619facbc3672e | |
21 | URL: https://toolbelt.readthedocs.io/ | |
0c903547 ER |
22 | BuildRequires: rpm-pythonprov |
23 | BuildRequires: rpmbuild(macros) >= 1.714 | |
cbd125fb | 24 | BuildRequires: sed >= 4.0 |
0c903547 | 25 | %if %{with python2} |
cbd125fb | 26 | BuildRequires: python-modules >= 1:2.7 |
0c903547 ER |
27 | BuildRequires: python-setuptools |
28 | %if %{with tests} | |
29 | BuildRequires: python-betamax | |
30 | BuildRequires: python-mock | |
cbd125fb | 31 | BuildRequires: python-pyOpenSSL |
0c903547 | 32 | BuildRequires: python-pytest |
cbd125fb JB |
33 | BuildRequires: python-requests >= 2.0.1 |
34 | BuildRequires: python-requests < 3 | |
0c903547 ER |
35 | %endif |
36 | %endif | |
37 | %if %{with python3} | |
cbd125fb | 38 | BuildRequires: python3-modules >= 1:3.3 |
0c903547 ER |
39 | BuildRequires: python3-setuptools |
40 | %if %{with tests} | |
41 | BuildRequires: python3-betamax | |
cbd125fb | 42 | BuildRequires: python3-pyOpenSSL |
0c903547 | 43 | BuildRequires: python3-pytest |
cbd125fb JB |
44 | BuildRequires: python3-requests >= 2.0.1 |
45 | BuildRequires: python3-requests < 3 | |
0c903547 ER |
46 | %endif |
47 | %endif | |
cbd125fb JB |
48 | %if %{with doc} |
49 | BuildRequires: python3-sphinx_rtd_theme | |
50 | BuildRequires: sphinx-pdg-3 | |
51 | %endif | |
0c903547 ER |
52 | BuildArch: noarch |
53 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
54 | ||
55 | %description | |
56 | This is just a collection of utilities for python-requests, but don't | |
57 | really belong in requests proper. | |
58 | ||
cbd125fb JB |
59 | %description -l pl.UTF-8 |
60 | Zbiór narzędzi dla python-requests, nie należących do samych requests. | |
61 | ||
0c903547 | 62 | %package -n python3-%{pypi_name} |
cbd125fb JB |
63 | Summary: Utility belt for advanced users of python-requests |
64 | Summary(pl.UTF-8): Pasek narzędzi dla zaawansowanych użytkowników python-requests | |
65 | Group: Libraries/Python | |
0c903547 ER |
66 | |
67 | %description -n python3-%{pypi_name} | |
68 | This is just a collection of utilities for python-requests, but don't | |
69 | really belong in requests proper. | |
70 | ||
cbd125fb JB |
71 | %description -n python3-%{pypi_name} -l pl.UTF-8 |
72 | Zbiór narzędzi dla python-requests, nie należących do samych requests. | |
73 | ||
74 | %package apidocs | |
75 | Summary: API documentation for Python requests_toolbelt module | |
76 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona requests_toolbelt | |
77 | Group: Documentation | |
78 | ||
79 | %description apidocs | |
80 | API documentation for Python requests_toolbelt module. | |
81 | ||
82 | %description apidocs -l pl.UTF-8 | |
83 | Dokumentacja API modułu Pythona requests_toolbelt. | |
84 | ||
0c903547 | 85 | %prep |
cbd125fb | 86 | %setup -q -n %{pypi_name}-%{version} |
0c903547 ER |
87 | |
88 | %build | |
89 | %if %{with python2} | |
90 | %py_build | |
cbd125fb | 91 | |
0c903547 | 92 | %if %{with tests} |
cbd125fb JB |
93 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
94 | PYTEST_PLUGINS="betamax.fixtures.pytest" \ | |
95 | %{__python} -m pytest -v tests | |
0c903547 ER |
96 | %endif |
97 | %endif | |
98 | ||
99 | %if %{with python3} | |
100 | %py3_build | |
cbd125fb | 101 | |
0c903547 | 102 | %if %{with tests} |
cbd125fb JB |
103 | %{__sed} -i -e 's/import mock/from unittest import mock/; s/from mock import/from unittest.mock import/' \ |
104 | tests/*.py tests/threaded/*.py | |
105 | ||
106 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
107 | PYTEST_PLUGINS="betamax.fixtures.pytest" \ | |
108 | %{__python3} -m pytest -v tests | |
0c903547 ER |
109 | %endif |
110 | %endif | |
111 | ||
cbd125fb JB |
112 | %if %{with doc} |
113 | %{__make} -C docs html \ | |
114 | SPHINXBUILD=sphinx-build-3 | |
115 | %endif | |
116 | ||
0c903547 ER |
117 | %install |
118 | rm -rf $RPM_BUILD_ROOT | |
cbd125fb JB |
119 | |
120 | %if %{with python2} | |
0c903547 | 121 | %py_install |
cbd125fb JB |
122 | %endif |
123 | ||
124 | %if %{with python3} | |
0c903547 | 125 | %py3_install |
cbd125fb | 126 | %endif |
0c903547 ER |
127 | |
128 | %clean | |
129 | rm -rf $RPM_BUILD_ROOT | |
130 | ||
131 | %if %{with python2} | |
132 | %files | |
133 | %defattr(644,root,root,755) | |
134 | %doc README.rst HISTORY.rst LICENSE | |
135 | %{py_sitescriptdir}/%{module} | |
136 | %{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
137 | %endif | |
138 | ||
139 | %if %{with python3} | |
140 | %files -n python3-%{pypi_name} | |
141 | %defattr(644,root,root,755) | |
142 | %doc README.rst HISTORY.rst LICENSE | |
143 | %{py3_sitescriptdir}/%{module} | |
144 | %{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info | |
145 | %endif | |
cbd125fb JB |
146 | |
147 | %if %{with doc} | |
148 | %files apidocs | |
149 | %defattr(644,root,root,755) | |
150 | %doc docs/_build/html/{_static,*.html,*.js} | |
151 | %endif |