summaryrefslogtreecommitdiff
path: root/dev-python/pygraphviz/pygraphviz-2.0.1-r1.ebuild
blob: 3942f5289698a00348a3829cdf10db2d82b53889 (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
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYPI_VERIFY_REPO=https://github.com/pygraphviz/pygraphviz
PYTHON_COMPAT=( python3_{13..14} )

inherit distutils-r1 flag-o-matic pypi toolchain-funcs

DESCRIPTION="Python wrapper for the Graphviz Agraph data structure"
HOMEPAGE="
	https://pygraphviz.github.io/
	https://github.com/pygraphviz/pygraphviz/
	https://pypi.org/project/pygraphviz/
"

LICENSE="BSD"
SLOT="0"
KEYWORDS="amd64 arm arm64 ~ppc64 ~riscv ~x86 ~x64-macos"

# Note: only C API of graphviz is used, PYTHON_USEDEP unnecessary.
# [cairo] is actually pangocairo, needed for gvplugin_pango.
DEPEND="
	media-gfx/graphviz:=[cairo]
"
RDEPEND="
	${DEPEND}
"
BDEPEND="
	dev-lang/swig:0
"

EPYTEST_PLUGINS=()
distutils_enable_tests pytest

src_configure() {
	# set to a meaningless path, it hardcodes /lib anyway; at least it
	# will stop it from adding a bunch of wrong RUNPATHs
	export GRAPHVIZ_PREFIX=${T}

	# upstream's solution to "not one of the random hardcoded paths" is
	# literally "add a bunch of -I -L flags yourself"
	append-cppflags $($(tc-getPKG_CONFIG) --cflags libcdt || die)
	local libdir=$($(tc-getPKG_CONFIG) --variable=libdir libcdt || die)
	# the build system will pass a bunch of "-l"s anyway
	append-ldflags $($(tc-getPKG_CONFIG) --libs-only-L libcdt || die) \
		-L"${libdir}/graphviz" -Wl,-rpath,"${libdir}/graphviz"
}

python_test() {
	rm -rf pygraphviz || die
	epytest --pyargs pygraphviz
}

python_install_all() {
	dodoc -r examples
	docompress -x /usr/share/doc/${PF}/examples

	distutils-r1_python_install_all
}