summaryrefslogtreecommitdiff
blob: 514d3fd4d220d2a3494e2715d6ff89b823c1953f (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
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

PYTHON_COMPAT=( python3_{11..12} )
inherit bash-completion-r1 python-any-r1

DESCRIPTION="Git utilities -- repo summary, repl, changelog population, and many more"
HOMEPAGE="https://github.com/tj/git-extras"
SRC_URI="https://github.com/tj/git-extras/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x64-macos"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="
	>=app-shells/bash-4.0:*
	dev-vcs/git
"
BDEPEND="
	test? (
		$(python_gen_any_dep '
			>=dev-python/GitPython-3.1.40[${PYTHON_USEDEP}]
			>=dev-python/pytest-7.2[${PYTHON_USEDEP}]
			dev-python/testpath[${PYTHON_USEDEP}]
		')
	)
"

python_check_deps() {
	python_has_version ">=dev-python/GitPython-3.1.40[${PYTHON_USEDEP}]" &&
		python_has_version ">=dev-python/pytest-7.2[${PYTHON_USEDEP}]" &&
		python_has_version "dev-python/testpath[${PYTHON_USEDEP}]"
}

pkg_setup() {
	use test && python-any-r1_pkg_setup
}

src_prepare() {
	default

	# For now, don't force including the git completion
	sed -i -e "1 i source $(get_bashcompdir)\/git" etc/bash_completion.sh || die
}

src_compile() {
	return
}

src_test() {
	epytest
}

src_install() {
	emake \
		DESTDIR="${D}" \
		PREFIX="${EPREFIX}/usr" \
		SYSCONFDIR="${EPREFIX}/etc" \
		COMPL_DIR="${D}/$(get_bashcompdir)" \
		install

	# TODO: Unfortunately, none of the completion seems to
	# actually work for me yet(?)

	newbashcomp "${S}"/etc/bash_completion.sh ${PN}

	insinto /usr/share/zsh/site-functions
	newins "${S}"/etc/${PN}-completion.zsh _${PN}

	insinto /usr/share/fish/vendor_completions.d
	doins "${S}"/etc/${PN}.fish
}