1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 PYTHON_COMPAT=( python3_{6,7,8} )
9 DESCRIPTION="Libmemcached wrapper written as a Python extension"
10 HOMEPAGE="http://sendapatch.se/projects/pylibmc/ https://pypi.org/project/pylibmc/"
11 # One image is missing from the doc at PyPI
12 # https://github.com/lericson/pylibmc/pull/221
13 SRC_URI="https://github.com/lericson/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
17 KEYWORDS="~alpha amd64 ~arm64 ~ppc ~ppc64 x86"
20 # implementations to use for building docs, separate from PYTHON_COMPAT since
21 # dev-python/sphinx might not be available everywhere
22 DOCS_PYTHON_COMPAT=( python{2_7,3_{6,7}} )
24 RDEPEND=">=dev-libs/libmemcached-0.32"
25 # Older sphinx versions fail to compile the doc
26 # https://github.com/sphinx-doc/sphinx/issues/3266
28 doc? ( $(python_gen_cond_dep '
29 >=dev-python/sphinx-1.5.1-r1[${PYTHON_USEDEP}]' "${DOCS_PYTHON_COMPAT[@]}")
33 dev-python/nose[${PYTHON_USEDEP}]
36 RESTRICT="!test? ( test )"
38 REQUIRED_USE="doc? ( || ( $(python_gen_useflags "${DOCS_PYTHON_COMPAT[@]}") ) )"
41 "${FILESDIR}/pylibmc-1.6.1-fix-test-failures-r1.patch"
45 use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( "${DOCS_PYTHON_COMPAT[@]}" )
48 python_prepare_all() {
49 sed -e "/with-info=1/d" -i setup.cfg || die
51 # some amazon thing, expects to be in AWS
52 rm tests/test_autoconf.py || die
53 distutils-r1_python_prepare_all
56 python_compile_all() {
58 # This variable is added to sys.path
59 # but it does not seem to be useful
60 PYLIBMC_DIR="." emake -C docs
61 HTML_DOCS=( docs/_build/html/. )
66 distutils_install_for_testing
67 memcached -d -p 11219 -u nobody -l localhost -P "${T}/m.pid" || die
68 MEMCACHED_PORT=11219 nosetests -v
70 kill "$(<"${T}/m.pid")" || die
71 [[ ${ret} == 0 ]] || die "Tests fail with ${EPYTHON}!"