*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / sys-auth / ssh-ldap-pubkey / ssh-ldap-pubkey-1.3.2.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="7"
5
6 PYTHON_COMPAT=( python2_7 python3_{6,7} )
7 inherit distutils-r1
8
9 DESCRIPTION="Utility to manage SSH public keys stored in LDAP"
10 HOMEPAGE="https://github.com/jirutka/ssh-ldap-pubkey"
11
12 if [[ ${PV} == "9999" ]]; then
13         EGIT_REPO_URI="https://github.com/jirutka/${PN}/${PN}.git"
14
15         inherit git-r3
16 else
17         SRC_URI="https://github.com/jirutka/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
18         KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86"
19 fi
20
21 LICENSE="MIT"
22 SLOT="0"
23 IUSE="schema test"
24 RESTRICT="!test? ( test )"
25
26 MY_CDEPEND="
27         dev-python/docopt[${PYTHON_USEDEP}]
28         >=dev-python/python-ldap-3.0[${PYTHON_USEDEP}]
29         virtual/logger"
30
31 DEPEND="
32         ${MY_CDEPEND}
33         dev-python/setuptools[${PYTHON_USEDEP}]
34         test? (
35                 dev-python/pytest[${PYTHON_USEDEP}]
36                 dev-python/pytest-describe[${PYTHON_USEDEP}]
37                 dev-python/pytest-mock[${PYTHON_USEDEP}]
38         )"
39
40 # We need to block previous net-misc/openssh packages
41 # to avoid file collision on "/etc/openldap/schema/openssh-lpk.schema"
42 RDEPEND="${MY_CDEPEND}
43         schema? ( !net-misc/openssh[ldap] )"
44
45 DOCS=( README.md CHANGELOG.adoc )
46
47 src_prepare() {
48         sed -i -e 's/pyldap/python-ldap >= 3.0/' setup.py || die
49         distutils-r1_src_prepare
50 }
51
52 python_test() {
53         pytest -vv || die "Tests failed under ${EPYTHON}"
54 }
55
56 python_install_all() {
57         distutils-r1_python_install_all
58
59         if use schema; then
60                 insinto /etc/openldap/schema
61                 doins etc/openssh-lpk.schema
62         fi
63
64         local MY_DOCDIR="/usr/share/doc/${PF}/examples"
65         insinto "${MY_DOCDIR}"
66         doins etc/ldap.conf
67
68         # We don't want to compress this small file to allow user
69         # to diff configuration against upstream's default
70         docompress -x "${MY_DOCDIR}"
71 }