dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / kombu / kombu-3.0.37-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python{2_7,3_4,3_5} pypy )
7
8 inherit distutils-r1
9
10 DESCRIPTION="AMQP Messaging Framework for Python"
11 HOMEPAGE="https://pypi.python.org/pypi/kombu https://github.com/celery/kombu"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
14 LICENSE="BSD"
15 SLOT="0"
16 KEYWORDS="amd64 ~arm64 x86"
17 IUSE="amqplib doc examples msgpack sqs test"
18
19 # couchdb backend support possible via dev-python/couchdb-python
20 # ditto dev-python/kazoo(>=1.3.1) and dev-python/beanstalkc
21 PY27_GEN_USEDEP=$(python_gen_usedep python2_7)
22 PYPY_GEN_USEDEP=$(python_gen_usedep python2_7 pypy)
23 RDEPEND="
24         >=dev-python/anyjson-0.3.3[${PYTHON_USEDEP}]
25         >=dev-python/py-amqp-1.4.9[${PYTHON_USEDEP}]
26         <dev-python/py-amqp-2.0[${PYTHON_USEDEP}]
27         dev-python/pyro:4[${PYTHON_USEDEP}]
28         $(python_gen_cond_dep '>=dev-python/pyzmq-13.1.0[${PYTHON_USEDEP}]' 'python*')
29         amqplib? ( >=dev-python/amqplib-1.0.2[${PYTHON_USEDEP}] )
30         sqs? ( >=dev-python/boto-2.13.3[${PY27_GEN_USEDEP}] )
31         msgpack? ( >=dev-python/msgpack-0.3.0[${PYTHON_USEDEP}] )"
32 # Fix to https://github.com/celery/kombu/issues/474 obliges dev-python/pymongo to >=-3.0.2
33 DEPEND="${RDEPEND}
34         >=dev-python/setuptools-0.7[${PYTHON_USEDEP}]
35         test? (
36                 >=dev-python/unittest2-0.5.0[${PYTHON_USEDEP}]
37                 dev-python/nose[${PYTHON_USEDEP}]
38                 dev-python/nose-cover3[${PYTHON_USEDEP}]
39                 >=dev-python/coverage-3.0[${PYTHON_USEDEP}]
40                 >=dev-python/mock-0.7.0[${PYPY_GEN_USEDEP}]
41                 dev-python/django[${PYTHON_USEDEP}]
42                 >=dev-python/redis-py-2.10.3[${PYTHON_USEDEP}]
43                 >=dev-python/pymongo-3.0.2[${PYTHON_USEDEP}]
44                 >=dev-python/pyyaml-3.10[${PYTHON_USEDEP}] )
45         doc? (
46                 dev-python/sphinx[${PYTHON_USEDEP}]
47                 dev-python/django[${PYTHON_USEDEP}]
48                 dev-python/beanstalkc[${PY27_GEN_USEDEP}]
49                 dev-python/couchdb-python[${PYTHON_USEDEP}]
50                 >=dev-python/sphinxcontrib-issuetracker-0.9[${PYTHON_USEDEP}] )"
51
52 # kazoo and sqlalchemy are optional packages for tests.
53 # Refrain for now, no established demand for it from users
54
55 # Req'd for test phase
56 DISTUTILS_IN_SOURCE_BUILD=1
57
58 PY27_REQUSE="$(python_gen_useflags 'python2*')"
59 REQUIRED_USE="
60         sqs? ( ${PY27_REQUSE} )
61         doc? ( ${PY27_REQUSE} amqplib sqs )"    # 2 deps in doc build are py2 capable only
62
63 PATCHES=(
64         "${FILESDIR}"/${PN}-NA-tests-fix.patch
65         )
66
67 pkg_setup() {
68         use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( python2.7 )
69 }
70
71 python_prepare_all() {
72         # https://github.com/celery/kombu/issues/246
73         sed -e 's:kombu.transports:kombu.transport:' -i funtests/tests/test_django.py
74         # allow use of new (renamed) msgpack
75         sed -i '/msgpack/d' requirements/extras/msgpack.txt || die
76         distutils-r1_python_prepare_all
77 }
78
79 python_compile_all() {
80         # Doc build must be done by py2.7
81         # Doc build misses and skips only content re librabbitmq which is not in portage
82         if use doc; then
83                 emake -C docs html || die "kombu docs failed installation"
84         fi
85 }
86
87 python_test() {
88         export DJANGO_SETTINGS_MODULE="django.conf"
89         # https://github.com/celery/kombu/issues/474
90         # tests need </pymongo-3.0; known to cause some breakage
91         if python_is_python3; then
92                 2to3 --no-diffs -w build/lib/kombu/transport/
93                 nosetests --py3where=build/lib kombu/tests || die "Tests failed under ${EPYTHON}"
94         else
95                 nosetests "${S}"/kombu/tests || die "Tests failed under ${EPYTHON}"
96                 # funtests appears to be coded only for py2, a kind of 2nd tier. pypy fails 6.
97                 # https://github.com/celery/kombu/issues/411
98                 # Fix to https://github.com/celery/kombu/issues/474 breaks the
99                 # funtests under >=dev-python/pymongo-3.0.2
100 #               if [[ "${EPYTHON}" == python2.7 ]]; then
101 #                       pushd funtests > /dev/null
102 #                       esetup.py test
103 #                       popd > /dev/null
104 #               fi
105         fi
106 }
107
108 python_install_all() {
109         use examples && local EXAMPLES=( examples/. )
110         use doc && local HTML_DOCS=( docs/.build/html/. )
111         distutils-r1_python_install_all
112 }