]>
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 |
4e22dadf | 14 | Version: 1.26.8 |
65b3314d | 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 |
4e22dadf | 20 | # Source0-md5: 50831ca7b19bbe2781abb0a4c2d51760 |
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 ŁK |
27 | %if %{with python2} |
28 | BuildRequires: python-modules >= 1:2.7 | |
fb337b23 | 29 | %if %{with tests} |
b07e9d23 | 30 | BuildRequires: python-PySocks >= 1.7.1 |
fb337b23 | 31 | BuildRequires: python-PySocks < 2.0 |
f5006321 | 32 | BuildRequires: python-cryptography >= 2.8 |
b07e9d23 JB |
33 | BuildRequires: python-dateutil >= 2.8.1 |
34 | BuildRequires: python-flaky >= 3.6.1 | |
f5006321 JB |
35 | # TODO |
36 | #BuildRequires: python-gcp_devrel-py-tools >= 0.0.15 | |
37 | BuildRequires: python-mock >= 3.0.5 | |
b07e9d23 JB |
38 | BuildRequires: python-pytest >= 4.6.9 |
39 | BuildRequires: python-pytest-freezegun >= 0.3.0 | |
40 | BuildRequires: python-pytest-timeout >= 1.3.4 | |
f5006321 JB |
41 | BuildRequires: python-tornado >= 5.1.1 |
42 | BuildRequires: python-trustme >= 0.5.3 | |
fb337b23 JB |
43 | # SO_REUSEPORT option |
44 | BuildRequires: uname(release) >= 3.9 | |
45 | %endif | |
f980972e ŁK |
46 | %endif |
47 | %if %{with python3} | |
f5006321 | 48 | BuildRequires: python3-modules >= 1:3.5 |
fb337b23 | 49 | %if %{with tests} |
b07e9d23 | 50 | BuildRequires: python3-PySocks >= 1.7.1 |
fb337b23 | 51 | BuildRequires: python3-PySocks < 2.0 |
f5006321 | 52 | BuildRequires: python3-cryptography >= 2.8 |
b07e9d23 JB |
53 | BuildRequires: python3-dateutil >= 2.8.1 |
54 | BuildRequires: python3-flaky >= 3.6.1 | |
f5006321 | 55 | #BuildRequires: python3-gcp_devrel-py-tools >= 0.0.15 |
b07e9d23 JB |
56 | BuildRequires: python3-pytest >= 4.6.9 |
57 | BuildRequires: python3-pytest-freezegun >= 0.4.2 | |
58 | BuildRequires: python3-pytest-timeout >= 1.3.4 | |
f5006321 JB |
59 | BuildRequires: python3-tornado >= 6.0.3 |
60 | BuildRequires: python3-trustme >= 0.5.3 | |
fb337b23 JB |
61 | # SO_REUSEPORT option |
62 | BuildRequires: uname(release) >= 3.9 | |
63 | %endif | |
f980972e ŁK |
64 | %endif |
65 | BuildRequires: rpm-pythonprov | |
fb337b23 | 66 | BuildRequires: rpmbuild(macros) >= 1.714 |
1cbae8fc | 67 | %if %{with doc} |
65b3314d JB |
68 | BuildRequires: python3-furo |
69 | BuildRequires: python3-requests >= 2 | |
70 | BuildRequires: sphinx-pdg-3 >= 3.0 | |
1cbae8fc | 71 | %endif |
f980972e ŁK |
72 | Requires: python-modules >= 1:2.7 |
73 | BuildArch: noarch | |
74 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
75 | ||
76 | %description | |
d1b278cf | 77 | Python 2 HTTP module with connection pooling and file POST abilities. |
f980972e ŁK |
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 | ||
d1b278cf JB |
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 | ||
f980972e ŁK |
96 | %package -n python3-urllib3 |
97 | Summary: HTTP library with thread-safe connection pooling, file post, and more | |
d1b278cf | 98 | Summary(pl.UTF-8): Biblioteka HTTP z bezpieczną wątkowo pulą połączeń, wysyłaniem plików itd. |
f980972e | 99 | Group: Development/Languages/Python |
f5006321 | 100 | Requires: python3-modules >= 1:3.5 |
f980972e ŁK |
101 | |
102 | %description -n python3-urllib3 | |
d1b278cf | 103 | Python 3 HTTP module with connection pooling and file POST abilities. |
f980972e ŁK |
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 | ||
d1b278cf JB |
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 | ||
1cbae8fc JB |
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 | ||
f980972e ŁK |
133 | %prep |
134 | %setup -q -n %{module}-%{version} | |
70df9369 | 135 | %patch0 -p1 |
f5006321 | 136 | %patch1 -p1 |
f980972e ŁK |
137 | |
138 | %build | |
139 | %if %{with python2} | |
f5006321 JB |
140 | %py_build |
141 | ||
b07e9d23 JB |
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. | |
f5006321 JB |
146 | LC_ALL=C.UTF-8 \ |
147 | PYTHONPATH=$(pwd)/src \ | |
b07e9d23 JB |
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)' | |
f5006321 | 152 | %endif |
f980972e ŁK |
153 | %endif |
154 | ||
155 | %if %{with python3} | |
f5006321 JB |
156 | %py3_build |
157 | ||
158 | %if %{with tests} | |
b07e9d23 JB |
159 | # RECENT_DATE is too old |
160 | # TestSSL: verification errors | |
f5006321 | 161 | PYTHONPATH=$(pwd)/src \ |
b07e9d23 JB |
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)' | |
f5006321 | 165 | %endif |
f980972e ŁK |
166 | %endif |
167 | ||
1cbae8fc | 168 | %if %{with doc} |
ad572b13 | 169 | %{__make} -C docs html \ |
70df9369 | 170 | SPHINXBUILD=sphinx-build-3 \ |
ad572b13 | 171 | SPHINXOPTS= |
1cbae8fc JB |
172 | %endif |
173 | ||
f980972e ŁK |
174 | %install |
175 | rm -rf $RPM_BUILD_ROOT | |
176 | ||
177 | %if %{with python2} | |
fb337b23 | 178 | %py_install |
b07e9d23 | 179 | |
f980972e ŁK |
180 | %py_postclean |
181 | %endif | |
182 | ||
183 | %if %{with python3} | |
fb337b23 | 184 | %py3_install |
fb337b23 | 185 | %endif |
f980972e ŁK |
186 | |
187 | %clean | |
188 | rm -rf $RPM_BUILD_ROOT | |
189 | ||
190 | %if %{with python2} | |
191 | %files | |
192 | %defattr(644,root,root,755) | |
4e22dadf | 193 | %doc CHANGES.rst LICENSE.txt README.rst |
f980972e | 194 | %{py_sitescriptdir}/%{module} |
f980972e ŁK |
195 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
196 | %endif | |
f980972e ŁK |
197 | |
198 | %if %{with python3} | |
199 | %files -n python3-urllib3 | |
200 | %defattr(644,root,root,755) | |
4e22dadf | 201 | %doc CHANGES.rst LICENSE.txt README.rst |
f980972e ŁK |
202 | %{py3_sitescriptdir}/%{module} |
203 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
204 | %endif | |
1cbae8fc JB |
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 |