]>
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 JR |
10 | Version: 3.8.1 |
11 | Release: 1 | |
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} | |
6241f097 JR |
21 | BuildRequires: python3-aiosignal |
22 | BuildRequires: python3-async_timeout >= 4.0 | |
de491045 JB |
23 | BuildRequires: python3-attrs >= 17.3.0 |
24 | BuildRequires: python3-brotli | |
25 | BuildRequires: python3-chardet >= 2.0 | |
8c252e87 | 26 | BuildRequires: python3-freezegun |
de491045 JB |
27 | BuildRequires: python3-gunicorn |
28 | %if "%{py3_ver}" < "3.7" | |
29 | BuildRequires: python3-idna-ssl | |
30 | %endif | |
31 | BuildRequires: python3-multidict >= 4.5 | |
32 | BuildRequires: python3-pytest >= 3.8.2 | |
33 | BuildRequires: python3-pytest-cov | |
34 | BuildRequires: python3-pytest-mock | |
35 | BuildRequires: python3-re_assert | |
36 | BuildRequires: python3-typing_extensions >= 3.6.5 | |
37 | BuildRequires: python3-yarl >= 1.0 | |
38 | %endif | |
39 | BuildRequires: rpm-pythonprov | |
40 | BuildRequires: rpmbuild(macros) >= 1.714 | |
de491045 JB |
41 | BuildRequires: sed >= 4.0 |
42 | %if %{with doc} | |
43 | BuildRequires: python3-aiohttp_theme | |
44 | BuildRequires: python3-sphinxcontrib-asyncio | |
45 | BuildRequires: python3-sphinxcontrib-blockdiag | |
46 | BuildRequires: sphinx-pdg-3 | |
47 | %endif | |
de491045 JB |
48 | Requires: python3-modules >= 1:3.6 |
49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
50 | ||
51 | %description | |
52 | Async http client/server framework. | |
53 | ||
54 | %description -l pl.UTF-8 | |
55 | Szkielet asynchronicznego klienta/serwera http. | |
56 | ||
57 | %package apidocs | |
58 | Summary: aiohttp API documentation | |
59 | Summary(pl.UTF-8): Dokumentacja API aiohttp | |
60 | Group: Documentation | |
c82b7263 | 61 | BuildArch: noarch |
de491045 JB |
62 | |
63 | %description apidocs | |
64 | API documentation for aiohttp. | |
65 | ||
66 | %description apidocs -l pl.UTF-8 | |
67 | Dokumentacja API aiohttp. | |
68 | ||
69 | %prep | |
70 | %setup -q -n aiohttp-%{version} | |
71 | %patch0 -p1 | |
72 | ||
6241f097 | 73 | %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' examples/*.py |
de491045 JB |
74 | |
75 | # adjust for python 3.7+ | |
76 | %{__sed} -i -e '/^from async_generator/d; /^ *@async_generator/d; s/await yield_/yield/' tests/*.py | |
77 | ||
78 | # until we have pytest >= 6: | |
79 | %{__sed} -i -e '/assert_outcomes/ s/errors=/error=/' tests/test_pytest_plugin.py | |
80 | ||
81 | %build | |
82 | %py3_build | |
83 | ||
84 | %if %{with tests} | |
85 | # test_data_stream_exc_chain uses network, fails | |
86 | # test_async_iterable_payload_default_content_type, test_async_iterable_payload_explicit_content_type fail with TypeError (need update?) | |
31c7af20 | 87 | # test_mark_formdata_as_processed requires network |
6241f097 | 88 | %{__mv} tests/test_proxy_functional.py{,.disabled} # needs proxy_py binary |
de491045 JB |
89 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ |
90 | PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \ | |
6241f097 | 91 | %{__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)' |
de491045 JB |
92 | %endif |
93 | ||
94 | %if %{with doc} | |
95 | %{__make} -C docs html \ | |
96 | SPHINXBUILD=sphinx-build-3 | |
97 | %endif | |
98 | ||
99 | %install | |
100 | rm -rf $RPM_BUILD_ROOT | |
101 | ||
102 | %py3_install | |
103 | ||
104 | %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/.hash | |
105 | %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/*.{c,h,pxd,pxi,pyx} | |
106 | ||
107 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
108 | cp -pr examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
109 | ||
110 | %clean | |
111 | rm -rf $RPM_BUILD_ROOT | |
112 | ||
113 | %files | |
114 | %defattr(644,root,root,755) | |
115 | %doc CHANGES.rst CONTRIBUTORS.txt README.rst | |
116 | %dir %{py3_sitedir}/aiohttp | |
117 | %attr(755,root,root) %{py3_sitedir}/aiohttp/*.so | |
118 | %{py3_sitedir}/aiohttp/*.py | |
119 | %{py3_sitedir}/aiohttp/*.pyi | |
120 | %{py3_sitedir}/aiohttp/py.typed | |
121 | %{py3_sitedir}/aiohttp/__pycache__ | |
122 | %{py3_sitedir}/aiohttp-%{version}-py*.egg-info | |
123 | %{_examplesdir}/%{name}-%{version} | |
124 | ||
125 | %if %{with doc} | |
126 | %files apidocs | |
127 | %defattr(644,root,root,755) | |
128 | %doc docs/_build/html/* | |
129 | %endif |