diamond-4.0-r1.ebuild 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. if [[ ${PV} = 9999* ]]; then
  5. inherit git-r3
  6. EGIT_REPO_URI="https://github.com/python-diamond/Diamond.git"
  7. S=${WORKDIR}/diamond-${PV}
  8. else
  9. SRC_URI="https://github.com/python-diamond/Diamond/archive/v${PV}.tar.gz -> python-diamond-${PV}.tar.gz"
  10. KEYWORDS="~amd64 ~x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
  11. S=${WORKDIR}/Diamond-${PV}
  12. fi
  13. PYTHON_COMPAT=( python2_7 )
  14. inherit distutils-r1 eutils prefix
  15. DESCRIPTION="Python daemon that collects and publishes system metrics"
  16. HOMEPAGE="https://github.com/python-diamond/Diamond"
  17. LICENSE="MIT"
  18. SLOT="0"
  19. IUSE="test mongo mysql snmp redis"
  20. RDEPEND="dev-python/configobj
  21. dev-python/setproctitle
  22. mongo? ( dev-python/pymongo )
  23. mysql? ( dev-python/mysql-python )
  24. snmp? ( dev-python/pysnmp )
  25. redis? ( dev-python/redis-py )
  26. !kernel_linux? ( >=dev-python/psutil-3 )"
  27. DEPEND="${RDEPEND}
  28. test? ( dev-python/mock )"
  29. src_prepare() {
  30. # adjust for Prefix
  31. hprefixify bin/diamond*
  32. # fix necessary to make handlers honour their config, simple sed
  33. # doing the same as upstream
  34. # https://github.com/python-diamond/Diamond/commit/3cb29eedd117d2e4146823a5c5811d16cc77206a.patch
  35. sed -i \
  36. -e '/cls_name =/s/\.__class__//' \
  37. src/diamond/utils/classes.py \
  38. || die
  39. epatch "${FILESDIR}"/${P}-psutil.patch
  40. distutils-r1_src_prepare
  41. }
  42. python_test() {
  43. "${PYTHON}" ./test.py || die "Tests fail with ${PYTHON}"
  44. }
  45. python_install() {
  46. export VIRTUAL_ENV=1
  47. distutils-r1_python_install
  48. mv "${ED}"/usr/etc "${ED}"/ || die
  49. rm "${ED}"/etc/diamond/*.windows # won't need these
  50. sed -i \
  51. -e '/pid_file =/s:/var/run:/run:' \
  52. "${ED}"/etc/diamond/diamond.conf.example || die
  53. hprefixify "${ED}"/etc/diamond/diamond.conf.example
  54. }
  55. src_install() {
  56. distutils-r1_src_install
  57. newinitd "${FILESDIR}"/${PN}.initd ${PN}
  58. newconfd "${FILESDIR}"/${PN}.confd ${PN}
  59. keepdir /var/log/diamond
  60. }