summaryrefslogtreecommitdiff
path: root/dev-python/livekit-api/livekit-api-1.2.1.ebuild
blob: d9279837c4cd9fb775b057e530a3d75b6f8b0db7 (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
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{13..14} )
DISTUTILS_USE_PEP517=hatchling

inherit distutils-r1

DESCRIPTION="LiveKit real-time and server SDKs for Python"
HOMEPAGE="
	https://github.com/livekit/python-sdks/
	https://pypi.org/project/livekit-api/
"
SRC_URI="https://github.com/livekit/python-sdks/archive/api-v${PV}.tar.gz -> ${P}.gh.tar.gz"

MY_TOPDIR="${WORKDIR}/python-sdks-api-v${PV}"
S="${MY_TOPDIR}/livekit-api"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~amd64"

RDEPEND="
	>=dev-python/pyjwt-2.0.0[${PYTHON_USEDEP}]
	>=dev-python/aiohttp-3.9.0[${PYTHON_USEDEP}]
	>=dev-python/protobuf-4[${PYTHON_USEDEP}]
	>=dev-python/types-protobuf-4[${PYTHON_USEDEP}]
	>=dev-python/livekit-protocol-1.1.27[${PYTHON_USEDEP}]
"

BDEPEND="
	test? (
		${RDEPEND}
		media-video/livekit[test-server]
	)
"

EPYTEST_PLUGINS=()
EPYTEST_IGNORE=(
	# This is a different subproject this package isn't installing
	tests/rtc/
)
EPYTEST_DESELECT=(
	# fails
	tests/api/test_livekitapi.py::test_sip_busy
)
distutils_enable_tests pytest

python_test() {
	cd "${MY_TOPDIR}" || die

	# Tests expect a running LiveKit mock server
	exec 3< <(livekit-test-server || die 'could not start LiveKit test server')
	local lk_pid=$!

	# Wait until it's ready
	while IFS= read -r line <&3 || die 'could not start LiveKit test server'; do
		echo "$line"
		[[ "$line" =~ "region-3 listening" ]] && break
	done
	cat <&3 &

	nonfatal epytest
	local epytest_result=$?

	kill -INT $lk_pid
	wait $lk_pid

	(( epytest_result == 0 )) || die "pytest failed with ${EPYTHON}"
}