Merge remote-tracking branch 'github/pr/674'.
[gentoo.git] / net-irc / limnoria / limnoria-99999999.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI="5"
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
7
8 inherit distutils-r1
9
10 MY_PV="${PV:0:4}-${PV:4:2}-${PV:6:2}"
11 MY_PN="Limnoria"
12 MY_P="${MY_PN}-${MY_PV}"
13
14 if [[ ${PV} == "99999999" ]]; then
15         EGIT_REPO_URI="git://github.com/ProgVal/Limnoria.git"
16         EGIT_BRANCH="testing"
17         inherit git-r3
18         SRC_URI=""
19 else
20         SRC_URI="https://github.com/ProgVal/${MY_PN}/archive/master-${MY_PV}.tar.gz -> ${P}.tar.gz"
21         KEYWORDS="~amd64 ~x86"
22         S="${WORKDIR}/${MY_PN}-master-${MY_PV}"
23 fi
24
25 DESCRIPTION="Python based extensible IRC infobot and channel bot"
26 HOMEPAGE="http://supybot.aperio.fr/"
27 LICENSE="BSD"
28 SLOT="0"
29 IUSE="crypt ssl test"
30
31 RDEPEND="
32         dev-python/chardet[${PYTHON_USEDEP}]
33         dev-python/ecdsa[${PYTHON_USEDEP}]
34         dev-python/feedparser[${PYTHON_USEDEP}]
35         dev-python/python-dateutil[${PYTHON_USEDEP}]
36         dev-python/pytz[${PYTHON_USEDEP}]
37         dev-python/PySocks[${PYTHON_USEDEP}]
38         dev-python/sqlalchemy[${PYTHON_USEDEP}]
39         crypt? ( dev-python/python-gnupg[${PYTHON_USEDEP}] )
40         ssl? ( dev-python/pyopenssl[${PYTHON_USEDEP}] )
41         !net-irc/supybot
42         !net-irc/supybot-plugins
43         "
44 DEPEND="${RDEPEND}
45         test? ( $(python_gen_cond_dep 'dev-python/mock[${PYTHON_USEDEP}]' python2_7) )"
46
47 src_unpack() {
48         if [[ ${PV} == "99999999" ]]; then
49                 git-r3_src_unpack
50         else
51                 unpack ${P}.tar.gz
52         fi
53 }
54
55 python_prepare(){
56         distutils-r1_python_prepare
57         if python_is_python3; then
58                 einfo "Removing the RSS plugin because of clashes between libxml2's Python3"
59                 einfo "bindings and feedparser."
60                 rm -rf "plugins/RSS" || die
61         fi
62 }
63
64 python_install_all() {
65         distutils-r1_python_install_all
66         doman man/*
67 }
68
69 python_test() {
70         pushd "${T}" > /dev/null
71         PLUGINS_DIR="${BUILD_DIR}/lib/supybot/plugins"
72         # recommended by upstream, unknown random failure
73         EXCLUDE_PLUGINS=( --exclude="${PLUGINS_DIR}/Scheduler" )
74         # recommended by upstream, unknown random failure
75         EXCLUDE_PLUGINS+=( --exclude="${PLUGINS_DIR}/Filter" )
76         # intermittent failure due to issues loading libsandbox.so from LD_PRELOAD
77         # runs successfully when running the tests on the installed system
78         EXCLUDE_PLUGINS+=( --exclude="${PLUGINS_DIR}/Unix" )
79         "${PYTHON}" "${BUILD_DIR}"/scripts/supybot-test "${BUILD_DIR}/../test" \
80                 --plugins-dir="${PLUGINS_DIR}" --no-network \
81                 --disable-multiprocessing "${EXCLUDE_PLUGINS[@]}" \
82                 || die "Tests failed under ${EPYTHON}"
83         popd > /dev/null
84 }
85
86 pkg_postinst() {
87         elog "Complete user documentation is available at https://limnoria-doc.readthedocs.org/"
88         elog ""
89         elog "Use supybot-wizard to create a configuration file."
90         elog "Run supybot </path/to/config> to use the bot."
91 }