summaryrefslogtreecommitdiff
path: root/dev-python/debugpy/debugpy-1.8.0.ebuild
blob: 71f66c164616c0fa945fe4dde74dabb9b235c35a (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
78
79
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{10..12} )

inherit distutils-r1 multiprocessing

DESCRIPTION="An implementation of the Debug Adapter Protocol for Python"
HOMEPAGE="
	https://github.com/microsoft/debugpy/
	https://pypi.org/project/debugpy/
"
SRC_URI="
	https://github.com/microsoft/${PN}/archive/v${PV}.tar.gz
		-> ${P}.gh.tar.gz
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~alpha ~amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"

RDEPEND="
	dev-python/pydevd[${PYTHON_USEDEP}]
"
BDEPEND="
	test? (
		dev-python/psutil[${PYTHON_USEDEP}]
		dev-python/requests[${PYTHON_USEDEP}]
		dev-python/pytest-timeout[${PYTHON_USEDEP}]
		dev-python/pytest-xdist[${PYTHON_USEDEP}]
	)
"

distutils_enable_tests pytest

python_prepare_all() {
	# Unbundle dev-python/pydevd
	rm -r src/debugpy/_vendored/pydevd || die
	local PATCHES=(
		"${FILESDIR}/${PN}-1.8.0-unbundle-pydevd.patch"
	)

	# Drop unnecessary and unrecognized option
	# __main__.py: error: unrecognized arguments: -n8
	# Do not timeout
	sed -e '/addopts/d' -e '/timeout/d' -i pytest.ini || die

	distutils-r1_python_prepare_all
}

python_test() {
	local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
	local EPYTEST_DESELECT=(
		tests/debugpy/test_gevent.py::test_gevent
		tests/debugpy/test_run.py::test_custom_python_args
		tests/tests/test_timeline.py::test_occurrences
		# TODO: random regressions
		tests/debugpy/test_flask.py::test_flask_breakpoint_multiproc
		tests/debugpy/test_exception.py::test_raise_exception_options
		tests/debugpy/test_exception.py::test_vsc_exception_options_raise_without_except
	)
	local EPYTEST_IGNORE=(
		tests/tests/test_vendoring.py
	)

	case ${EPYTHON} in
		python3.12)
			EPYTEST_DESELECT+=(
				tests/debugpy/test_flask.py
			)
			;;
	esac

	epytest -p timeout -p xdist -n "$(makeopts_jobs)" --dist=worksteal \
		-k "not attach_pid"
}