Merge remote-tracking branch 'github/pr/703'. Fixes bug 560362.
[gentoo.git] / dev-python / flask-restless / flask-restless-0.16.0.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} pypy )
7
8 PYTHON_REQ_USE="sqlite"
9 inherit distutils-r1
10
11 DESCRIPTION="Flask extension for easy ReSTful API generation"
12 HOMEPAGE="http://packages.python.org/Flask-Restless/"
13 SRC_URI="https://github.com/jfinkels/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
14
15 LICENSE="|| ( AGPL-3 BSD )"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18
19 IUSE="doc examples test"
20
21 RDEPEND=">=dev-python/flask-0.7[${PYTHON_USEDEP}]
22         dev-python/flask-sqlalchemy[${PYTHON_USEDEP}]
23         dev-python/sqlalchemy[${PYTHON_USEDEP}]
24         dev-python/python-dateutil:0[${PYTHON_USEDEP}]
25         dev-python/mimerender[${PYTHON_USEDEP}]"
26 DEPEND="${RDEPEND}
27         dev-python/setuptools[${PYTHON_USEDEP}]
28         test? ( dev-python/nose[${PYTHON_USEDEP}] )
29         doc? ( dev-python/sphinx[${PYTHON_USEDEP}]
30                 >=dev-python/sphinxcontrib-httpdomain-1.1.7[${PYTHON_USEDEP}]
31                 >=dev-python/sphinxcontrib-issuetracker-0.11[${PYTHON_USEDEP}]
32                 dev-python/flask-themes[${PYTHON_USEDEP}] )"
33
34 PATCHES=( "${FILESDIR}"/mapping.patch )
35
36 python_compile_all() {
37         if use doc; then
38                 if ! "${PYTHON}" -c "import flask_restless"; then
39                         eerror "flask-restless is not installed. Building of the docs"
40                         eerror "requires flask-restless to be installed."
41                         eerror "emerge with USE=-doc followed bu USE=doc"
42                         die
43                 fi
44                 # Changes connect to read issues @ github
45                 rm -f docs/changelog.rst
46                 einfo "Generating html docs for ${PN}"
47                 PYTHONPATH=${PYTHONPATH}"${S}"/docs emake -C docs html \
48                         || die "Generating html docs for ${PN} failed"
49         fi
50 }
51
52 python_test() {
53         nosetests -w tests || die "Tests failed under ${EPYTHON}"
54 }
55
56 python_install_all() {
57         use doc && local HTML_DOCS=( docs/_build/html/. )
58         use examples && local EXAMPLES=( examples/. )
59         distutils-r1_python_install_all
60 }