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