]>
Commit | Line | Data |
---|---|---|
fb337b23 | 1 | # TODO: use system six, [backports.]ssl_match_hostname |
d1b278cf | 2 | # |
f980972e | 3 | # Conditional build: |
d1b278cf JB |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
1cbae8fc | 6 | %bcond_without doc # Sphinx documentation |
f5006321 | 7 | %bcond_with tests # test target (uses network etc., few failures) |
5381b073 ER |
8 | |
9 | %define module urllib3 | |
f980972e | 10 | Summary: HTTP library with thread-safe connection pooling, file post, and more |
d1b278cf | 11 | Summary(pl.UTF-8): Biblioteka HTTP z bezpieczną wątkowo pulą połączeń, wysyłaniem plików itd. |
f980972e | 12 | Name: python-%{module} |
65b3314d | 13 | # note: maintain versions compatible with python-requests.spec |
2ca24533 | 14 | Version: 1.26.18 |
ec94c334 | 15 | Release: 1 |
f980972e ŁK |
16 | License: MIT |
17 | Group: Development/Languages/Python | |
70df9369 | 18 | #Source0Download: https://pypi.org/simple/urllib3/ |
1cbae8fc | 19 | Source0: https://files.pythonhosted.org/packages/source/u/urllib3/%{module}-%{version}.tar.gz |
2ca24533 | 20 | # Source0-md5: f986d8e9616d2a43389f678d5dad9893 |
70df9369 | 21 | Patch0: %{name}-mock.patch |
f5006321 | 22 | Patch1: %{name}-httplib.patch |
65b3314d | 23 | URL: https://urllib3.readthedocs.io/ |
f5006321 JB |
24 | %if %(locale -a | grep -q '^C\.utf8$'; echo $?) |
25 | BuildRequires: glibc-localedb-all | |
26 | %endif | |
f980972e | 27 | %if %{with python2} |
1357614b | 28 | BuildRequires: python >= 1:2.7 |
f980972e | 29 | BuildRequires: python-modules >= 1:2.7 |
11a7fa17 | 30 | BuildRequires: python-setuptools |
fb337b23 | 31 | %if %{with tests} |
b07e9d23 | 32 | BuildRequires: python-PySocks >= 1.7.1 |
fb337b23 | 33 | BuildRequires: python-PySocks < 2.0 |
f5006321 | 34 | BuildRequires: python-cryptography >= 2.8 |
b07e9d23 JB |
35 | BuildRequires: python-dateutil >= 2.8.1 |
36 | BuildRequires: python-flaky >= 3.6.1 | |
f5006321 JB |
37 | # TODO |
38 | #BuildRequires: python-gcp_devrel-py-tools >= 0.0.15 | |
39 | BuildRequires: python-mock >= 3.0.5 | |
b07e9d23 JB |
40 | BuildRequires: python-pytest >= 4.6.9 |
41 | BuildRequires: python-pytest-freezegun >= 0.3.0 | |
42 | BuildRequires: python-pytest-timeout >= 1.3.4 | |
f5006321 JB |
43 | BuildRequires: python-tornado >= 5.1.1 |
44 | BuildRequires: python-trustme >= 0.5.3 | |
fb337b23 JB |
45 | # SO_REUSEPORT option |
46 | BuildRequires: uname(release) >= 3.9 | |
47 | %endif | |
f980972e ŁK |
48 | %endif |
49 | %if %{with python3} | |
1357614b | 50 | BuildRequires: python3 >= 1:3.5 |
f5006321 | 51 | BuildRequires: python3-modules >= 1:3.5 |
11a7fa17 | 52 | BuildRequires: python3-setuptools |
fb337b23 | 53 | %if %{with tests} |
b07e9d23 | 54 | BuildRequires: python3-PySocks >= 1.7.1 |
fb337b23 | 55 | BuildRequires: python3-PySocks < 2.0 |
f5006321 | 56 | BuildRequires: python3-cryptography >= 2.8 |
b07e9d23 JB |
57 | BuildRequires: python3-dateutil >= 2.8.1 |
58 | BuildRequires: python3-flaky >= 3.6.1 | |
f5006321 | 59 | #BuildRequires: python3-gcp_devrel-py-tools >= 0.0.15 |
b07e9d23 JB |
60 | BuildRequires: python3-pytest >= 4.6.9 |
61 | BuildRequires: python3-pytest-freezegun >= 0.4.2 | |
62 | BuildRequires: python3-pytest-timeout >= 1.3.4 | |
f5006321 JB |
63 | BuildRequires: python3-tornado >= 6.0.3 |
64 | BuildRequires: python3-trustme >= 0.5.3 | |
fb337b23 JB |
65 | # SO_REUSEPORT option |
66 | BuildRequires: uname(release) >= 3.9 | |
67 | %endif | |
f980972e ŁK |
68 | %endif |
69 | BuildRequires: rpm-pythonprov | |
fb337b23 | 70 | BuildRequires: rpmbuild(macros) >= 1.714 |
1cbae8fc | 71 | %if %{with doc} |
65b3314d JB |
72 | BuildRequires: python3-furo |
73 | BuildRequires: python3-requests >= 2 | |
74 | BuildRequires: sphinx-pdg-3 >= 3.0 | |
1cbae8fc | 75 | %endif |
f980972e ŁK |
76 | Requires: python-modules >= 1:2.7 |
77 | BuildArch: noarch | |
78 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
79 | ||
80 | %description | |
d1b278cf | 81 | Python 2 HTTP module with connection pooling and file POST abilities. |
f980972e ŁK |
82 | Features are: |
83 | - Re-use the same socket connection for multiple requests (with | |
84 | optional client-side certificate verification). | |
85 | - File posting (encode_multipart_formdata). | |
86 | - Built-in redirection and retries (optional). | |
87 | - Supports gzip and deflate decoding. | |
88 | - Thread-safe and sanity-safe. | |
89 | ||
d1b278cf JB |
90 | %description -l pl.UTF-8 |
91 | Moduł HTTP dla Pythona 2 z pulą połączeń i możliwością wysyłania | |
92 | plików metodą POST. Możliwości: | |
93 | - używanie tego samego połączenia dla wielu żądań (z opcjonalną | |
94 | weryfikacją certyfikatu po stronie klienta) | |
95 | - wysyłanie plików (encode_multipart_formdata) | |
96 | - wbudowane przekierowania i ponawianie prób (opcjonalne) | |
97 | - obsługa kodowań gzip i deflate | |
98 | - bezpieczeństwo względem wątków. | |
99 | ||
f980972e ŁK |
100 | %package -n python3-urllib3 |
101 | Summary: HTTP library with thread-safe connection pooling, file post, and more | |
d1b278cf | 102 | Summary(pl.UTF-8): Biblioteka HTTP z bezpieczną wątkowo pulą połączeń, wysyłaniem plików itd. |
f980972e | 103 | Group: Development/Languages/Python |
f5006321 | 104 | Requires: python3-modules >= 1:3.5 |
f980972e ŁK |
105 | |
106 | %description -n python3-urllib3 | |
d1b278cf | 107 | Python 3 HTTP module with connection pooling and file POST abilities. |
f980972e ŁK |
108 | Features are: |
109 | - Re-use the same socket connection for multiple requests (with | |
110 | optional client-side certificate verification). | |
111 | - File posting (encode_multipart_formdata). | |
112 | - Built-in redirection and retries (optional). | |
113 | - Supports gzip and deflate decoding. | |
114 | - Thread-safe and sanity-safe. | |
115 | ||
d1b278cf JB |
116 | %description -n python3-urllib3 -l pl.UTF-8 |
117 | Moduł HTTP dla Pythona 3 z pulą połączeń i możliwością wysyłania | |
118 | plików metodą POST. Możliwości: | |
119 | - używanie tego samego połączenia dla wielu żądań (z opcjonalną | |
120 | weryfikacją certyfikatu po stronie klienta) | |
121 | - wysyłanie plików (encode_multipart_formdata) | |
122 | - wbudowane przekierowania i ponawianie prób (opcjonalne) | |
123 | - obsługa kodowań gzip i deflate | |
124 | - bezpieczeństwo względem wątków. | |
125 | ||
1cbae8fc JB |
126 | %package apidocs |
127 | Summary: API documentation for Python urllib3 module | |
128 | Summary(pl.UTF-8): Dokumentacja API modułu Pythona urllib3 | |
129 | Group: Documentation | |
130 | ||
131 | %description apidocs | |
132 | API documentation for Python urllib3 module. | |
133 | ||
134 | %description apidocs -l pl.UTF-8 | |
135 | Dokumentacja API modułu Pythona urllib3. | |
136 | ||
f980972e ŁK |
137 | %prep |
138 | %setup -q -n %{module}-%{version} | |
70df9369 | 139 | %patch0 -p1 |
f5006321 | 140 | %patch1 -p1 |
f980972e ŁK |
141 | |
142 | %build | |
143 | %if %{with python2} | |
f5006321 JB |
144 | %py_build |
145 | ||
b07e9d23 JB |
146 | %if %{with tests} |
147 | # RECENT_DATE is too old | |
148 | # test_retry.py: many failures with py2 | |
149 | # TestSSL: unknown ca, timeout errors etc. | |
f5006321 JB |
150 | LC_ALL=C.UTF-8 \ |
151 | PYTHONPATH=$(pwd)/src \ | |
b07e9d23 JB |
152 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
153 | PYTEST_PLUGINS="flaky.flaky_pytest_plugin,pytest_freezegun,pytest_timeout" \ | |
154 | %{__python} -m pytest test -k 'not (test_recent_date or test_retry or test_ssl_read_timeout or test_ssl_failed_fingerprint_verification)' | |
155 | # or TestSSL)' | |
f5006321 | 156 | %endif |
f980972e ŁK |
157 | %endif |
158 | ||
159 | %if %{with python3} | |
f5006321 JB |
160 | %py3_build |
161 | ||
162 | %if %{with tests} | |
b07e9d23 JB |
163 | # RECENT_DATE is too old |
164 | # TestSSL: verification errors | |
f5006321 | 165 | PYTHONPATH=$(pwd)/src \ |
b07e9d23 JB |
166 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
167 | PYTEST_PLUGINS="flaky.flaky_pytest_plugin,pytest_freezegun,pytest_timeout" \ | |
168 | %{__python3} -m pytest test -k 'not (test_recent_date or test_ssl_read_timeout or test_ssl_failed_fingerprint_verification)' | |
f5006321 | 169 | %endif |
f980972e ŁK |
170 | %endif |
171 | ||
1cbae8fc | 172 | %if %{with doc} |
ad572b13 | 173 | %{__make} -C docs html \ |
70df9369 | 174 | SPHINXBUILD=sphinx-build-3 \ |
ad572b13 | 175 | SPHINXOPTS= |
1cbae8fc JB |
176 | %endif |
177 | ||
f980972e ŁK |
178 | %install |
179 | rm -rf $RPM_BUILD_ROOT | |
180 | ||
181 | %if %{with python2} | |
fb337b23 | 182 | %py_install |
b07e9d23 | 183 | |
f980972e ŁK |
184 | %py_postclean |
185 | %endif | |
186 | ||
187 | %if %{with python3} | |
fb337b23 | 188 | %py3_install |
fb337b23 | 189 | %endif |
f980972e ŁK |
190 | |
191 | %clean | |
192 | rm -rf $RPM_BUILD_ROOT | |
193 | ||
194 | %if %{with python2} | |
195 | %files | |
196 | %defattr(644,root,root,755) | |
4e22dadf | 197 | %doc CHANGES.rst LICENSE.txt README.rst |
f980972e | 198 | %{py_sitescriptdir}/%{module} |
f980972e ŁK |
199 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
200 | %endif | |
f980972e ŁK |
201 | |
202 | %if %{with python3} | |
203 | %files -n python3-urllib3 | |
204 | %defattr(644,root,root,755) | |
4e22dadf | 205 | %doc CHANGES.rst LICENSE.txt README.rst |
f980972e ŁK |
206 | %{py3_sitescriptdir}/%{module} |
207 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
208 | %endif | |
1cbae8fc JB |
209 | |
210 | %if %{with doc} | |
211 | %files apidocs | |
212 | %defattr(644,root,root,755) | |
213 | %doc docs/_build/html/{_static,reference,*.html,*.js} | |
214 | %endif |