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