aboutsummaryrefslogtreecommitdiff
blob: 927e2d41b46c5ee0081d117eb9bb9ec7a1727785 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7,8,9} )
DISTUTILS_USE_SETUPTOOLS=rdepend

DOCS_BUILDER="mkdocs"
DOCS_DEPEND="dev-python/mkdocs-material"

inherit distutils-r1 docs optfeature

DESCRIPTION="The lightning-fast ASGI server"
HOMEPAGE="https://www.uvicorn.org/
	https://github.com/encode/uvicorn"
SRC_URI="https://github.com/encode/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="BSD"
KEYWORDS="~amd64 ~x86"
SLOT="0"

# lots of these
# 'AsyncConnectionPool' object has no attribute 'arequest'
RESTRICT="test"

RDEPEND="
	>=dev-python/click-7[${PYTHON_USEDEP}]
	<dev-python/click-8[${PYTHON_USEDEP}]
	>=dev-python/h11-0.8[${PYTHON_USEDEP}]
	$(python_gen_cond_dep 'dev-python/typing-extensions[${PYTHON_USEDEP}]' python3_7)
"

BDEPEND="test? (
	dev-python/cryptography[${PYTHON_USEDEP}]
	>=dev-python/colorama-0.4[${PYTHON_USEDEP}]
	dev-python/pytest-mock[${PYTHON_USEDEP}]
	>=dev-python/python-dotenv-0.13[${PYTHON_USEDEP}]
	>=dev-python/pyyaml-5.1[${PYTHON_USEDEP}]
	dev-python/trustme[${PYTHON_USEDEP}]
	>=dev-python/uvloop-0.14.0[${PYTHON_USEDEP}]
	>=dev-python/websockets-8.0[${PYTHON_USEDEP}]
	<dev-python/websockets-9.0[${PYTHON_USEDEP}]
	>=dev-python/httptools-0.1[${PYTHON_USEDEP}]
	<dev-python/httptools-0.2[${PYTHON_USEDEP}]
	dev-python/httpx[${PYTHON_USEDEP}]
	>=dev-python/watchgod-0.6[${PYTHON_USEDEP}]
	dev-python/wsproto[${PYTHON_USEDEP}]
)"

distutils_enable_tests pytest

python_prepare_all() {
	# do not install LICENSE to /usr/
	sed -i -e '/data_files/d' setup.py || die

	# Remove pytest-cov dep
	sed -i -e '21,22d' setup.cfg || die

	distutils-r1_python_prepare_all
}

pkg_postinst() {
	optfeature "asyncio event loop on top of libuv" dev-python/uvloop
	optfeature "websockets support using wsproto" dev-python/wsproto
	optfeature "websockets support using websockets" dev-python/websockets
	optfeature "httpstools package for http protocol" dev-python/httptools
	optfeature "efficient debug reload" dev-python/watchgod
}

python_test() {
	pytest -vv \
			--deselect tests/protocols/test_http.py::test_supported_upgrade_request[H11Protocol] \
			--deselect tests/protocols/test_http.py::test_supported_upgrade_request[HttpToolsProtocol] \
			--deselect tests/protocols/test_websocket.py::test_invalid_upgrade[WSProtocol] \
	|| die
}