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

EAPI=7

PYTHON_COMPAT=( python3_10 )

inherit distutils-r1

DESCRIPTION="commandline tool to sync directory services to local cache"
HOMEPAGE="https://github.com/google/nsscache"
SCRIPT_A='nsscache-0.30-r3-gentoo-authorized-keys-command.py'
SRC_URI="
	https://github.com/google/nsscache/archive/version/${PV}.tar.gz -> ${P}.tar.gz
	https://dev.gentoo.org/~robbat2/${SCRIPT_A}"

LICENSE="GPL-2"
SLOT="0"
#KEYWORDS="~amd64 ~x86"
KEYWORDS="" # pending infra testing
IUSE="nsscache s3 test"
RESTRICT="test" # requires network

#test? ( dev-python/pytest-cov[${PYTHON_USEDEP}] dev-python/mox3[${PYTHON_USEDEP}] )
DEPEND="
	dev-python/ldap3[${PYTHON_USEDEP}]
	dev-python/pycurl[${PYTHON_USEDEP}]
	s3? ( dev-python/boto3[${PYTHON_USEDEP}] )"
RDEPEND="${DEPEND}
	nsscache? ( >=sys-auth/libnss-cache-0.10 )"

S="${WORKDIR}/${PN}-version-${PV}"

python_prepare_all() {
	# If tests are disabled in the ebuild, disable in setup
	if [[ "${RESTRICT/test}" != "$RESTRICT" ]]; then
		sed -i \
			-e "/setup_requires/s,'pytest-runner',,g" \
			-e '/tests_require/s,\[.*\],[],g' \
			setup.py || die
		sed -i \
			-e '/test=pytest/d' \
			setup.cfg || die
		sed -i \
			-e '/pytest/d' \
			requirements.txt || die
	fi

	distutils-r1_python_prepare_all
}

python_compile() {
	distutils-r1_python_compile --verbose
}

python_install() {
	distutils-r1_python_install

	python_scriptinto /usr/libexec/nsscache
	python_newexe "${DISTDIR}"/"${SCRIPT_A}" authorized-keys-command.py
}

python_install_all() {
	distutils-r1_python_install_all

	doman nsscache.1 nsscache.conf.5
	dodoc THANKS nsscache.cron CONTRIBUTING.md README.md

	keepdir /var/lib/nsscache
}

[[ "${RESTRICT/test}" != "$RESTRICT" ]] && distutils_enable_tests pytest