summaryrefslogtreecommitdiff
path: root/dev-python/knowit/knowit-0.5.6.ebuild
blob: c62ab7078ce053629d86fbb352f2d0fb87e2e97a (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
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=poetry
PYTHON_COMPAT=( python3_{11..13} )

inherit distutils-r1

DESCRIPTION="Know better your media files"
HOMEPAGE="
	https://github.com/ratoaq2/knowit
	https://pypi.org/project/knowit/
"
# No tests in sdist
SRC_URI="https://github.com/ratoaq2/knowit/archive/refs/tags/${PV}.tar.gz -> ${P}.gh.tar.gz"
SRC_URI+=" test? ( https://downloads.sourceforge.net/matroska/test_files/matroska_test_w1_1.zip )"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

# https://github.com/ratoaq2/knowit/blob/d7135a4797440838bca94e76326fc9d4019d8f9a/README.md?plain=1#L224
RDEPEND="
	dev-python/babelfish[${PYTHON_USEDEP}]
	dev-python/enzyme[${PYTHON_USEDEP}]
	dev-python/trakit[${PYTHON_USEDEP}]
	dev-python/pymediainfo[${PYTHON_USEDEP}]
	dev-python/pyyaml[${PYTHON_USEDEP}]
	|| (
		media-video/ffmpeg
		media-video/mediainfo
		media-video/mkvtoolnix
	)
"
BDEPEND="
	test? (
		app-arch/unzip
		dev-python/requests[${PYTHON_USEDEP}]
		media-video/ffmpeg
		media-video/mediainfo
		media-video/mkvtoolnix
	)
"

PATCHES=(
	"${FILESDIR}"/${PN}-0.5.6-no-pint.patch
)

distutils_enable_tests pytest

src_unpack() {
	# Needed to unpack the test data
	default

	if [[ ${PV} == 9999 ]] ; then
		git-r3_src_unpack
	fi
}

python_prepare_all() {
	if use test ; then
		mkdir -p tests/data/videos || die
		ln -s "${WORKDIR}"/test*.mkv tests/data/videos/ || die
	fi

	distutils-r1_python_prepare_all
}