summaryrefslogtreecommitdiff
blob: 981a4a81c2790cf7ba9858f2c02de1d71bf1ac0f (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{7..9} )
DISTUTILS_USE_SETUPTOOLS=rdepend
inherit distutils-r1

MY_PN="errbot"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="Multiprotocol chatbot designed to be easily deployable and maintainable"
HOMEPAGE="https://errbot.readthedocs.io/en/latest/"
SRC_URI="https://github.com/errbotio/errbot/archive/${PV}.tar.gz -> ${P}.tar.gz"

KEYWORDS="~amd64"
LICENSE="GPL-3"
SLOT="0"
IUSE="irc +xmpp"

DEPEND="
	acct-group/err
	acct-user/err"
RDEPEND="${DEPEND}
	dev-python/ansi[${PYTHON_USEDEP}]
	dev-python/bottle[${PYTHON_USEDEP}]
	dev-python/colorlog[${PYTHON_USEDEP}]
	dev-python/cryptography[${PYTHON_USEDEP}]
	dev-python/daemonize[${PYTHON_USEDEP}]
	dev-python/deepmerge[${PYTHON_USEDEP}]
	dev-python/dulwich[${PYTHON_USEDEP}]
	dev-python/flask[${PYTHON_USEDEP}]
	dev-python/jinja[${PYTHON_USEDEP}]
	dev-python/markdown[${PYTHON_USEDEP}]
	dev-python/pygments[${PYTHON_USEDEP}]
	dev-python/pyopenssl[${PYTHON_USEDEP}]
	dev-python/requests[${PYTHON_USEDEP}]
	dev-python/webtest[${PYTHON_USEDEP}]
	irc? (
		dev-python/irc[${PYTHON_USEDEP}]
	)
	xmpp? (
		dev-python/pyasn1[${PYTHON_USEDEP}]
		dev-python/pyasn1-modules[${PYTHON_USEDEP}]
		dev-python/slixmpp[${PYTHON_USEDEP}]
	)
"
S="${WORKDIR}/${MY_P}"

distutils_enable_tests pytest

# NOTES:
# 1. Support for BOT_SENTRY option is missing, cause
#    we do not have apropriate packages in portage yet
# 2. Currently only XMPP is supported(IRC still untested)
# 3. Internal web server is temporarily removed (rocket-err from requires.txt)
# 4. pygments-markdown-lexer dependency(needed only for debugging?) is temporarily removed (pygments-markdown-lexer from requires.txt)

python_prepare_all() {
	sed -i -e '/pygments-markdown-lexer/d' setup.py || die

	# NameError: name 'slack' is not defined
	rm tests/backend_tests/slack_test.py || die

	distutils-r1_python_prepare_all
}

python_test() {
	local deselect=(
		--deselect tests/commands_test.py::test_plugin_cycle
		--deselect tests/commands_test.py::test_broken_plugin
		--deselect tests/commands_test.py::test_backup
		--deselect tests/plugin_management_test.py::test_check_dependencies_requi
	)

	pytest -vv "${deselect[@]}" || die "Tests failed with ${EPYTHON}"
}

python_install_all() {
	distutils-r1_python_install_all

	newinitd "${FILESDIR}"/errd.initd.2 errd
	newconfd "${FILESDIR}"/errd.confd errd

	dodir /etc/${PN}
	keepdir /var/lib/${PN}
	keepdir /var/log/${PN}
	fowners -R err:err /var/lib/${PN}
	fowners -R err:err /var/log/${PN}

	insinto /etc/${PN}
	newins errbot/config-template.py config.py
}