blob: 09a6bbf21055e1771af5b5bb4e4e82a5894fc177 (
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
|
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/diamond/diamond-4.0-r1.ebuild,v 1.2 2015/04/08 07:30:34 mgorny Exp $
EAPI=5
if [[ ${PV} = 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/python-diamond/Diamond.git"
S=${WORKDIR}/diamond-${PV}
else
SRC_URI="https://github.com/python-diamond/Diamond/archive/v${PV}.tar.gz -> python-diamond-${PV}.tar.gz"
KEYWORDS="~x86 ~amd64"
S=${WORKDIR}/Diamond-${PV}
fi
PYTHON_COMPAT=( python2_7 )
inherit distutils-r1
DESCRIPTION="Python daemon that collects and publishes system metrics"
HOMEPAGE="https://github.com/python-diamond/Diamond"
LICENSE="MIT"
SLOT="0"
IUSE="test mongo mysql snmp redis"
RDEPEND="dev-python/configobj
dev-python/setproctitle
mongo? ( dev-python/pymongo )
mysql? ( dev-python/mysql-python )
snmp? ( dev-python/pysnmp )
redis? ( dev-python/redis-py )"
DEPEND="${RDEPEND}
test? ( dev-python/mock )"
src_prepare() {
# adjust for Prefix
sed -i \
-e '/default="\/etc\/diamond\/diamond.conf"/s:=":="'"${EPREFIX}"':' \
bin/diamond* \
|| die
# fix necessary to make handlers honour their config, simple sed
# doing the same as upstream
# https://github.com/python-diamond/Diamond/commit/3cb29eedd117d2e4146823a5c5811d16cc77206a.patch
sed -i \
-e '/cls_name =/s/\.__class__//' \
src/diamond/utils/classes.py \
|| die
distutils-r1_src_prepare
}
python_test() {
"${PYTHON}" ./test.py || die "Tests fail with ${PYTHON}"
}
python_install() {
export VIRTUAL_ENV=1
distutils-r1_python_install
mv "${ED}"/usr/etc "${ED}"/ || die
rm "${ED}"/etc/diamond/*.windows # won't need these
sed -i \
-e '/pid_file =/s:/var/run:/run:' \
"${ED}"/etc/diamond/diamond.conf.example || die
}
src_install() {
distutils-r1_src_install
newinitd "${FILESDIR}"/${PN}.initd ${PN}
newconfd "${FILESDIR}"/${PN}.confd ${PN}
keepdir /var/log/diamond
}
|