summaryrefslogtreecommitdiff
blob: ac7a4519c107f72c3d7702e8bfaad2e31f6a07c6 (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
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{9..11} )

inherit distutils-r1 virtualx

DESCRIPTION="PyQt4/PyQt5 compatibility layer"
HOMEPAGE="
	https://github.com/ales-erjavec/anyqt/
	https://pypi.org/project/AnyQt/
"
SRC_URI="
	https://github.com/ales-erjavec/anyqt/archive/${PV}.tar.gz
		-> ${P}.gh.tar.gz
"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"

RDEPEND="
	|| (
		dev-python/pyside2[${PYTHON_USEDEP}]
		dev-python/PyQt5[${PYTHON_USEDEP}]
	)
"
BDEPEND="
	test? (
		dev-python/pyside2[testlib,${PYTHON_USEDEP}]
		dev-python/PyQt5[testlib,${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest

src_test() {
	virtx distutils-r1_src_test
}

python_test() {
	local -x QT_API
	# plugins may preload Qt modules
	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
	for QT_API in pyqt5 pyside2; do
		local EPYTEST_IGNORE=()
		[[ ${QT_API} == pyside2 ]] && EPYTEST_IGNORE+=(
			tests/test_qaction_set_menu.py
		)

		einfo "Testing ${QT_API}"
		nonfatal epytest tests ||
			die "Tests failed with ${EPYTHON} / ${QT_API}"
	done
}