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