- disable test requiring network
[packages/python3-aiohttp.git] / python3-aiohttp.spec
1 #
2 # Conditional build:
3 %bcond_without  doc     # API documentation
4 %bcond_without  tests   # unit tests
5
6 %define         module  template
7 Summary:        Async http client/server framework
8 Summary(pl.UTF-8):      Szkielet asynchronicznego klienta/serwera http
9 Name:           python3-aiohttp
10 Version:        3.7.3
11 Release:        1
12 License:        Apache v2.0
13 Group:          Libraries/Python
14 #Source0Download: https://pypi.org/simple/aiohttp/
15 Source0:        https://files.pythonhosted.org/packages/source/a/aiohttp/aiohttp-%{version}.tar.gz
16 # Source0-md5:  a66039c12f33dd093a2c260f5c459632
17 # adjusted from https://github.com/aio-libs/aiohttp/commit/9afc44b052643213da15c9583ecbd643ca999601.patch
18 Patch0:         %{name}-brotli.patch
19 URL:            https://pypi.org/project/aiohttp/
20 BuildRequires:  python3-devel >= 1:3.6
21 BuildRequires:  python3-setuptools
22 %if %{with tests}
23 BuildRequires:  python3-async_timeout >= 3.0
24 BuildRequires:  python3-attrs >= 17.3.0
25 BuildRequires:  python3-brotli
26 BuildRequires:  python3-chardet >= 2.0
27 BuildRequires:  python3-freezegun
28 BuildRequires:  python3-gunicorn
29 %if "%{py3_ver}" < "3.7"
30 BuildRequires:  python3-idna-ssl
31 %endif
32 BuildRequires:  python3-multidict >= 4.5
33 BuildRequires:  python3-pytest >= 3.8.2
34 BuildRequires:  python3-pytest-cov
35 BuildRequires:  python3-pytest-mock
36 BuildRequires:  python3-re_assert
37 BuildRequires:  python3-typing_extensions >= 3.6.5
38 BuildRequires:  python3-yarl >= 1.0
39 %endif
40 BuildRequires:  rpm-pythonprov
41 BuildRequires:  rpmbuild(macros) >= 1.714
42 # if using noarchpackage, replace with:
43 #BuildRequires: rpmbuild(macros) >= 1.752
44 BuildRequires:  sed >= 4.0
45 %if %{with doc}
46 BuildRequires:  python3-aiohttp_theme
47 BuildRequires:  python3-sphinxcontrib-asyncio
48 BuildRequires:  python3-sphinxcontrib-blockdiag
49 BuildRequires:  sphinx-pdg-3
50 %endif
51 # replace with other requires if defined in setup.py
52 Requires:       python3-modules >= 1:3.6
53 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
54
55 %description
56 Async http client/server framework.
57
58 %description -l pl.UTF-8
59 Szkielet asynchronicznego klienta/serwera http.
60
61 %package apidocs
62 Summary:        aiohttp API documentation
63 Summary(pl.UTF-8):      Dokumentacja API aiohttp
64 Group:          Documentation
65 %{?noarchpackage}
66
67 %description apidocs
68 API documentation for aiohttp.
69
70 %description apidocs -l pl.UTF-8
71 Dokumentacja API aiohttp.
72
73 %prep
74 %setup -q -n aiohttp-%{version}
75 %patch0 -p1
76
77 %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' examples/*.py examples/legacy/*.py
78
79 # adjust for python 3.7+
80 %{__sed} -i -e '/^from async_generator/d; /^ *@async_generator/d; s/await yield_/yield/' tests/*.py
81
82 # until we have pytest >= 6:
83 %{__sed} -i -e '/assert_outcomes/ s/errors=/error=/' tests/test_pytest_plugin.py
84
85 %build
86 %py3_build
87
88 %if %{with tests}
89 # test_data_stream_exc_chain uses network, fails
90 # test_async_iterable_payload_default_content_type, test_async_iterable_payload_explicit_content_type fail with TypeError (need update?)
91 # test_mark_formdata_as_processed requires network
92 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
93 PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \
94 %{__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)'
95 %endif
96
97 %if %{with doc}
98 %{__make} -C docs html \
99         SPHINXBUILD=sphinx-build-3
100 %endif
101
102 %install
103 rm -rf $RPM_BUILD_ROOT
104
105 %py3_install
106
107 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/.hash
108 %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/*.{c,h,pxd,pxi,pyx}
109
110 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
111 cp -pr examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
112
113 %clean
114 rm -rf $RPM_BUILD_ROOT
115
116 %files
117 %defattr(644,root,root,755)
118 %doc CHANGES.rst CONTRIBUTORS.txt README.rst
119 %dir %{py3_sitedir}/aiohttp
120 %attr(755,root,root) %{py3_sitedir}/aiohttp/*.so
121 %{py3_sitedir}/aiohttp/*.py
122 %{py3_sitedir}/aiohttp/*.pyi
123 %{py3_sitedir}/aiohttp/py.typed
124 %{py3_sitedir}/aiohttp/__pycache__
125 %{py3_sitedir}/aiohttp-%{version}-py*.egg-info
126 %{_examplesdir}/%{name}-%{version}
127
128 %if %{with doc}
129 %files apidocs
130 %defattr(644,root,root,755)
131 %doc docs/_build/html/*
132 %endif
This page took 0.051287 seconds and 3 git commands to generate.