- tests BR: python3-freezegun
[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 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
92 PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \
93 %{__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)'
94 %endif
95
96 %if %{with doc}
97 %{__make} -C docs html \
98         SPHINXBUILD=sphinx-build-3
99 %endif
100
101 %install
102 rm -rf $RPM_BUILD_ROOT
103
104 %py3_install
105
106 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/.hash
107 %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/*.{c,h,pxd,pxi,pyx}
108
109 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
110 cp -pr examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
111
112 %clean
113 rm -rf $RPM_BUILD_ROOT
114
115 %files
116 %defattr(644,root,root,755)
117 %doc CHANGES.rst CONTRIBUTORS.txt README.rst
118 %dir %{py3_sitedir}/aiohttp
119 %attr(755,root,root) %{py3_sitedir}/aiohttp/*.so
120 %{py3_sitedir}/aiohttp/*.py
121 %{py3_sitedir}/aiohttp/*.pyi
122 %{py3_sitedir}/aiohttp/py.typed
123 %{py3_sitedir}/aiohttp/__pycache__
124 %{py3_sitedir}/aiohttp-%{version}-py*.egg-info
125 %{_examplesdir}/%{name}-%{version}
126
127 %if %{with doc}
128 %files apidocs
129 %defattr(644,root,root,755)
130 %doc docs/_build/html/*
131 %endif
This page took 0.051143 seconds and 3 git commands to generate.