summaryrefslogtreecommitdiff
path: root/dev-python/av/av-17.0.0.ebuild
blob: 4ffe6fb8de5aec8affe919b1686e4e8a66e7f377 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..14} )

inherit distutils-r1

MY_PN="PyAV"
MY_P=${MY_PN}-${PV}

DESCRIPTION="Pythonic bindings for FFmpeg's libraries"
HOMEPAGE="
	https://pyav.basswood-io.com/docs/stable/
	https://pypi.org/project/av/
	https://github.com/PyAV-Org/PyAV/
"

if [[ ${PV} == *9999 ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/PyAV-Org/PyAV.git"
else
	# pypi misses documentation
	SRC_URI="https://github.com/PyAV-Org/PyAV/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"
	KEYWORDS="~amd64"
	S=${WORKDIR}/${MY_P}
fi

LICENSE="BSD"
SLOT="0"

IUSE="examples"

BDEPEND="
	virtual/pkgconfig
	>=dev-python/cython-3.1.0[${PYTHON_USEDEP}]
	test? (
		dev-python/numpy[${PYTHON_USEDEP}]
		dev-python/pillow[${PYTHON_USEDEP}]
	)
"
DEPEND="media-video/ffmpeg:="
RDEPEND="
	media-video/ffmpeg:=
	dev-python/numpy[${PYTHON_USEDEP}]
	dev-python/pillow[${PYTHON_USEDEP}]
"

DOCS=( README.md {AUTHORS,CHANGELOG}.rst )

EPYTEST_PLUGINS=()
distutils_enable_tests pytest
distutils_enable_sphinx docs dev-python/sphinx-copybutton

EPYTEST_DESELECT=(
	# needs network access
	tests/test_doctests.py
	tests/test_timeout.py
)

src_prepare() {
	default

	# package directory must be deleted due to C ext.
	# use PV instead of reading from pkg. dir.
	sed -i \
	-e 's|about = {}|about = {"__version__": "'"${PV}"'"}|' \
	-e '/with open/,+2d' \
	docs/conf.py || die
}

python_compile_all() {
	rm -rf av || die

	sphinx_compile_all
}

python_install_all() {
	if use examples; then
		dodoc -r examples
		docompress -x /usr/share/doc/${PF}/examples
	fi
	distutils-r1_python_install_all
}

python_test() {
	rm -rf av || die

	epytest
}