a7ee4b4d6a4ad95592ded4ebc8a5c632bb63e61e
[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-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
41 # if using noarchpackage, replace with:
42 #BuildRequires: rpmbuild(macros) >= 1.752
43 BuildRequires:  sed >= 4.0
44 %if %{with doc}
45 BuildRequires:  python3-aiohttp_theme
46 BuildRequires:  python3-sphinxcontrib-asyncio
47 BuildRequires:  python3-sphinxcontrib-blockdiag
48 BuildRequires:  sphinx-pdg-3
49 %endif
50 # replace with other requires if defined in setup.py
51 Requires:       python3-modules >= 1:3.6
52 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
53
54 %description
55 Async http client/server framework.
56
57 %description -l pl.UTF-8
58 Szkielet asynchronicznego klienta/serwera http.
59
60 %package apidocs
61 Summary:        aiohttp API documentation
62 Summary(pl.UTF-8):      Dokumentacja API aiohttp
63 Group:          Documentation
64 %{?noarchpackage}
65
66 %description apidocs
67 API documentation for aiohttp.
68
69 %description apidocs -l pl.UTF-8
70 Dokumentacja API aiohttp.
71
72 %prep
73 %setup -q -n aiohttp-%{version}
74 %patch0 -p1
75
76 %{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' examples/*.py examples/legacy/*.py
77
78 # adjust for python 3.7+
79 %{__sed} -i -e '/^from async_generator/d; /^ *@async_generator/d; s/await yield_/yield/' tests/*.py
80
81 # until we have pytest >= 6:
82 %{__sed} -i -e '/assert_outcomes/ s/errors=/error=/' tests/test_pytest_plugin.py
83
84 %build
85 %py3_build
86
87 %if %{with tests}
88 # test_data_stream_exc_chain uses network, fails
89 # test_async_iterable_payload_default_content_type, test_async_iterable_payload_explicit_content_type fail with TypeError (need update?)
90 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
91 PYTEST_PLUGINS="pytest_cov.plugin,pytest_mock" \
92 %{__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)'
93 %endif
94
95 %if %{with doc}
96 %{__make} -C docs html \
97         SPHINXBUILD=sphinx-build-3
98 %endif
99
100 %install
101 rm -rf $RPM_BUILD_ROOT
102
103 %py3_install
104
105 %{__rm} -r $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/.hash
106 %{__rm} $RPM_BUILD_ROOT%{py3_sitedir}/aiohttp/*.{c,h,pxd,pxi,pyx}
107
108 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
109 cp -pr examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
110
111 %clean
112 rm -rf $RPM_BUILD_ROOT
113
114 %files
115 %defattr(644,root,root,755)
116 %doc CHANGES.rst CONTRIBUTORS.txt README.rst
117 %dir %{py3_sitedir}/aiohttp
118 %attr(755,root,root) %{py3_sitedir}/aiohttp/*.so
119 %{py3_sitedir}/aiohttp/*.py
120 %{py3_sitedir}/aiohttp/*.pyi
121 %{py3_sitedir}/aiohttp/py.typed
122 %{py3_sitedir}/aiohttp/__pycache__
123 %{py3_sitedir}/aiohttp-%{version}-py*.egg-info
124 %{_examplesdir}/%{name}-%{version}
125
126 %if %{with doc}
127 %files apidocs
128 %defattr(644,root,root,755)
129 %doc docs/_build/html/*
130 %endif
This page took 0.048699 seconds and 2 git commands to generate.