]>
Commit | Line | Data |
---|---|---|
de491045 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # API documentation | |
4 | %bcond_without tests # unit tests | |
5 | ||
12133ea8 | 6 | %define module template |
de491045 JB |
7 | Summary: Async http client/server framework |
8 | Summary(pl.UTF-8): Szkielet asynchronicznego klienta/serwera http | |
9 | Name: python3-aiohttp | |
6241f097 | 10 | Version: 3.8.1 |
5ca0c842 | 11 | Release: 2 |
de491045 JB |
12 | License: Apache v2.0 |
13 | Group: Libraries/Python | |
de491045 | 14 | Source0: https://files.pythonhosted.org/packages/source/a/aiohttp/aiohttp-%{version}.tar.gz |
6241f097 JR |
15 | # Source0-md5: faf7726dc65a940272874c0f441e8ec6 |
16 | Patch0: disable-towncrier.patch | |
de491045 JB |
17 | URL: https://pypi.org/project/aiohttp/ |
18 | BuildRequires: python3-devel >= 1:3.6 | |
19 | BuildRequires: python3-setuptools | |
20 | %if %{with tests} | |
b926511c JB |
21 | #BuildRequires: python3-aiodns >= 1.1 |
22 | BuildRequires: python3-aiosignal >= 1.1.2 | |
6241f097 | 23 | BuildRequires: python3-async_timeout >= 4.0 |
b926511c JB |
24 | BuildRequires: python3-async_timeout < 5 |
25 | %if "%{py3_ver}" < "3.8" | |
26 | BuildRequires: python3-asynctest = 0.13.0 | |
27 | %endif | |
de491045 JB |
28 | BuildRequires: python3-attrs >= 17.3.0 |
29 | BuildRequires: python3-brotli | |
b926511c JB |
30 | BuildRequires: python3-charset_normalizer >= 2.0 |
31 | BuildRequires: python3-charset_normalizer < 3 | |
32 | BuildRequires: python3-cchardet | |
8c252e87 | 33 | BuildRequires: python3-freezegun |
b926511c | 34 | BuildRequires: python3-frozenlist >= 1.1.1 |
de491045 JB |
35 | BuildRequires: python3-gunicorn |
36 | %if "%{py3_ver}" < "3.7" | |
b926511c | 37 | BuildRequires: python3-idna-ssl >= 1.0 |
de491045 JB |
38 | %endif |
39 | BuildRequires: python3-multidict >= 4.5 | |
b926511c | 40 | BuildRequires: python3-multidict < 7 |
de491045 JB |
41 | BuildRequires: python3-pytest >= 3.8.2 |
42 | BuildRequires: python3-pytest-cov | |
43 | BuildRequires: python3-pytest-mock | |
44 | BuildRequires: python3-re_assert | |
b926511c | 45 | %if "%{py3_ver}" < "3.8" |
de491045 | 46 | BuildRequires: python3-typing_extensions >= 3.6.5 |
b926511c | 47 | %endif |
de491045 | 48 | BuildRequires: python3-yarl >= 1.0 |
b926511c | 49 | BuildRequires: python3-yarl < 2 |
de491045 JB |
50 | %endif |
51 | BuildRequires: rpm-pythonprov | |
52 | BuildRequires: rpmbuild(macros) >= 1.714 | |
de491045 JB |
53 | BuildRequires: sed >= 4.0 |
54 | %if %{with doc} | |
55 | BuildRequires: python3-aiohttp_theme | |
56 | BuildRequires: python3-sphinxcontrib-asyncio | |
57 | BuildRequires: python3-sphinxcontrib-blockdiag | |
58 | BuildRequires: sphinx-pdg-3 | |
59 | %endif | |
de491045 JB |
60 | Requires: python3-modules >= 1:3.6 |
61 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
62 | ||
63 | %description | |
64 | Async http client/server framework. | |
65 | ||
66 | %description -l pl.UTF-8 | |
67 | Szkielet asynchronicznego klienta/serwera http. | |
68 | ||
69 | %package apidocs | |
70 | Summary: aiohttp API documentation | |
71 | Summary(pl.UTF-8): Dokumentacja API aiohttp | |
72 | Group: Documentation | |
c82b7263 | 73 | BuildArch: noarch |
de491045 JB |
74 | |
75 | %description apidocs | |
76 | API documentation for aiohttp. | |
77 | ||
78 | %description apidocs -l pl.UTF-8 | |
79 | Dokumentacja API aiohttp. | |
80 | ||
81 | %prep | |
82 | %setup -q -n aiohttp-%{version} | |
83 | %patch0 -p1 | |
84 | ||
6241f097 | 85 | %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' examples/*.py |
de491045 JB |
86 | |
87 | # adjust for python 3.7+ | |
88 | %{__sed} -i -e '/^from async_generator/d; /^ *@async_generator/d; s/await yield_/yield/' tests/*.py | |
89 | ||
de491045 JB |
90 | %build |
91 | %py3_build | |
92 | ||
93 | %if %{with tests} | |
94 | # test_data_stream_exc_chain uses network, fails | |
95 | # test_async_iterable_payload_default_content_type, test_async_iterable_payload_explicit_content_type fail with TypeError (need update?) | |
31c7af20 | 96 | # test_mark_formdata_as_processed requires network |
33e3ae05 JR |
97 | # test_client_session_timeout_zero fails on builders |
98 | # test_requote_redirect_url_default uses network, fails | |
6241f097 | 99 | %{__mv} tests/test_proxy_functional.py{,.disabled} # needs proxy_py binary |
de491045 JB |
100 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
101 | PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \ | |
33e3ae05 | 102 | %{__python3} -m pytest tests -k 'not (test_data_stream_exc_chain or test_async_iterable_payload_default_content_type or test_async_iterable_payload_explicit_content_type or test_mark_formdata_as_processed or test_c_parser_loaded or test_aiohttp_plugin_async_fixture or test_client_session_timeout_zero or test_requote_redirect_url_default)' |
de491045 JB |
103 | %endif |
104 | ||
105 | %if %{with doc} | |
106 | %{__make} -C docs html \ | |
b926511c JB |
107 | SPHINXBUILD=sphinx-build-3 \ |
108 | SPHINXOPTS="-n" | |
de491045 JB |
109 | %endif |
110 | ||
111 | %install | |
112 | rm -rf $RPM_BUILD_ROOT | |
113 | ||
114 | %py3_install | |
115 | ||
116 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/.hash | |
117 | %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/*.{c,h,pxd,pxi,pyx} | |
118 | ||
119 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
120 | cp -pr examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
121 | ||
122 | %clean | |
123 | rm -rf $RPM_BUILD_ROOT | |
124 | ||
125 | %files | |
126 | %defattr(644,root,root,755) | |
127 | %doc CHANGES.rst CONTRIBUTORS.txt README.rst | |
128 | %dir %{py3_sitedir}/aiohttp | |
129 | %attr(755,root,root) %{py3_sitedir}/aiohttp/*.so | |
130 | %{py3_sitedir}/aiohttp/*.py | |
131 | %{py3_sitedir}/aiohttp/*.pyi | |
132 | %{py3_sitedir}/aiohttp/py.typed | |
133 | %{py3_sitedir}/aiohttp/__pycache__ | |
134 | %{py3_sitedir}/aiohttp-%{version}-py*.egg-info | |
135 | %{_examplesdir}/%{name}-%{version} | |
136 | ||
137 | %if %{with doc} | |
138 | %files apidocs | |
139 | %defattr(644,root,root,755) | |
140 | %doc docs/_build/html/* | |
141 | %endif |