*/*: [QA] Fix trivial cases of MissingTestRestrict
[gentoo.git] / dev-python / ws4py / ws4py-0.3.4.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # We could depend on dev-python/cherrypy when USE=server, but
5 # that is an optional component ...
6 # Same for www-servers/tornado and USE=client ... so why not???
7 # pypy is viable but better with a cutdown set of deps
8
9 EAPI=5
10 PYTHON_COMPAT=( python{2_7,3_5} )
11 PYTHON_REQ_USE="threads?"
12
13 inherit distutils-r1
14 if [[ ${PV} == *9999* ]] ; then
15         EGIT_REPO_URI="https://github.com/Lawouach/WebSocket-for-Python.git"
16         inherit git-r3
17 else
18         inherit vcs-snapshot
19         SRC_URI="https://github.com/Lawouach/WebSocket-for-Python/archive/v${PV} -> ${P}.tar.gz"
20         KEYWORDS="amd64 arm x86"
21 fi
22
23 DESCRIPTION="WebSocket client and server library for Python 2 and 3 as well as PyPy"
24 HOMEPAGE="https://github.com/Lawouach/WebSocket-for-Python"
25
26 LICENSE="BSD"
27 SLOT="0"
28 IUSE="+client +server test +threads"
29 RESTRICT="!test? ( test )"
30 # doc build requires sphinxcontrib ext packages absent from portage
31
32 RDEPEND=">=dev-python/greenlet-0.4.1[${PYTHON_USEDEP}]
33                 $(python_gen_cond_dep 'dev-python/gevent[${PYTHON_USEDEP}]' python2_7)
34                 >=dev-python/cython-0.19.1[${PYTHON_USEDEP}]
35                 client? ( >=www-servers/tornado-3.1[${PYTHON_USEDEP}] )
36                 server? ( >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}] )"
37 DEPEND="test? (
38                 >=dev-python/cherrypy-3.2.4[${PYTHON_USEDEP}]
39                 dev-python/unittest2[${PYTHON_USEDEP}]
40                 >=dev-python/mock-1.0.1[${PYTHON_USEDEP}]
41         )"
42
43 python_test() {
44         # testsuite displays an issue with mock under py3 but is non fatal
45         "${PYTHON}" -m unittest discover || die "Tests failed under ${EPYTHON}"
46 }
47
48 python_install() {
49         distutils-r1_python_install
50         use client || rm -rf "${D}$(python_get_sitedir)"/ws4py/client
51         use server || rm -rf "${D}$(python_get_sitedir)"/ws4py/server
52 }