1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{4,5,6} pypy )
10 MY_PN="${PN##python-}"
13 DESCRIPTION="A non-validating SQL parser module for Python"
14 HOMEPAGE="https://github.com/andialbrecht/sqlparse"
15 SRC_URI="mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz"
18 KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux"
22 REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*') ) )"
25 dev-python/setuptools[${PYTHON_USEDEP}]
26 doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
28 dev-python/pytest[${PYTHON_USEDEP}]
29 dev-python/pytest-cov[${PYTHON_USEDEP}]
31 # Required for running tests
32 DISTUTILS_IN_SOURCE_BUILD=1
34 S="${WORKDIR}"/${P#python-}
37 use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
40 python_compile_all() {
41 use doc && emake -C docs html
45 if python_is_python3; then
46 2to3 -w --no-diffs -n tests/ sqlparse/
47 py.test ./tests || die "testsuite failed ${EPYTHON}"
49 py.test tests || die "testsuite failed under ${EPYTHON}"
53 python_install_all() {
54 use doc && local HTML_DOCS=( docs/build/html/. )
55 distutils-r1_python_install_all