aboutsummaryrefslogtreecommitdiff
blob: 94327131e76197108c27fe92a4e98fffc3e53a2a (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_EXT=1
PYTHON_COMPAT=( python3_{11..12} )
DISTUTILS_USE_PEP517=setuptools

# Docs depend on dev-python/sphinx-py3doc-enhanced-theme
# Which was treecleaned from ::gentoo
# DOCS_BUILDER="sphinx"
# DOCS_DEPEND="dev-python/sphinx-py3doc-enhanced-theme"
# DOCS_DIR="docs"

inherit distutils-r1 # docs

DESCRIPTION="Hunter is a flexible code tracing toolkit"
HOMEPAGE="
	https://github.com/ionelmc/python-hunter
	https://pypi.org/project/hunter/
"
SRC_URI="https://github.com/ionelmc/python-${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
S="${WORKDIR}/python-${P}"

LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64"

BDEPEND="
	dev-python/cython[${PYTHON_USEDEP}]
	test? (
		dev-python/aspectlib[${PYTHON_USEDEP}]
		dev-python/ipdb[${PYTHON_USEDEP}]
		dev-python/manhole[${PYTHON_USEDEP}]
		dev-python/process-tests[${PYTHON_USEDEP}]
		dev-python/pytest-benchmark[${PYTHON_USEDEP}]
		dev-python/six[${PYTHON_USEDEP}]
	)
"

# DOCS=( AUTHORS.rst CHANGELOG.rst README.rst )

PATCHES=(
	# Upstream uses a custom file to define backend as setuptools
	"${FILESDIR}/fix_backend.patch"
)

distutils_enable_tests pytest

EPYTEST_DESELECT=(
	# I think it needs internet
	tests/test_remote.py::test_manhole_clean_exit
	# Need a py.io module that does not seem to exist
	tests/test_util.py::test_safe_repr
	# Permission denied in a chroot
	tests/test_remote.py::test_gdb
	tests/test_remote.py::test_gdb_clean_exit
)

python_test() {
	# Need to import files in tests folder
	cd "${S}/tests" || die
	if [[ "${EPYTHON}" == "python3.12" ]]; then
		EPYTEST_DESELECT+=(
			# From what I could understand, it fail because of a change in pathlib in 3.12
			tests/test_cookbook.py::test_profile
			tests/test_integration.py::test_errorsnooper
			tests/test_integration.py::test_errorsnooper_fastmode
		)
	fi
	epytest
}

src_prepare() {
	# Need a module that does not exist (see https://github.com/ionelmc/python-hunter/issues/116)
	rm "${S}/tests/test_tracer.py" || die
	distutils-r1_src_prepare
}