dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / django / django-1.5.12.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5 PYTHON_COMPAT=( python2_7 pypy )
6 PYTHON_REQ_USE='sqlite?,threads(+)'
7 WEBAPP_NO_AUTO_INSTALL="yes"
8
9 inherit bash-completion-r1 distutils-r1 versionator webapp
10
11 MY_P="Django-${PV}"
12
13 DESCRIPTION="High-level Python web framework"
14 HOMEPAGE="https://www.djangoproject.com/ https://pypi.python.org/pypi/Django"
15 SRC_URI="https://www.djangoproject.com/m/releases/$(get_version_component_range 1-2)/${MY_P}.tar.gz"
16
17 LICENSE="BSD"
18 SLOT="0"
19 KEYWORDS=""
20 IUSE="doc mysql postgres sqlite test"
21
22 PY2_USEDEP=$(python_gen_usedep 'python*')
23 RDEPEND="dev-python/pillow[${PYTHON_USEDEP}]
24         postgres? ( dev-python/psycopg:2[${PY2_USEDEP}] )
25         mysql? ( >=dev-python/mysql-python-1.2.3[${PY2_USEDEP}] )"
26 DEPEND="${RDEPEND}
27         doc? ( >=dev-python/sphinx-1.0.7[${PYTHON_USEDEP}] )
28         test? ( $(python_gen_impl_dep sqlite) )"
29
30 REQUIRED_USE="mysql? ( $(python_gen_useflags 'python2*') )
31                 postgres? ( || ( $(python_gen_useflags 'python2*') ) )"
32
33 S="${WORKDIR}/${MY_P}"
34
35 WEBAPP_MANUAL_SLOT="yes"
36
37 PATCHES=( "${FILESDIR}"/${PN}-1.5.4-objects.patch \
38                 "${FILESDIR}"/${PN}-1.5-py3tests.patch )
39
40 python_compile_all() {
41         if use doc; then
42                 emake -C docs html
43         fi
44 }
45
46 python_test() {
47         # Tests have non-standard assumptions about PYTHONPATH,
48         # and don't work with ${BUILD_DIR}/lib.
49         # https://code.djangoproject.com/ticket/20514
50         PYTHONPATH=. "${PYTHON}" tests/runtests.py --settings=test_sqlite -v1 \
51                 || die "Tests fail with ${EPYTHON}"
52 }
53
54 src_install() {
55         distutils-r1_src_install
56         webapp_src_install
57 }
58
59 python_install_all() {
60         newbashcomp extras/django_bash_completion ${PN}
61
62         if use doc; then
63                 rm -fr docs/_build/html/_sources
64                 local HTML_DOCS=( docs/_build/html/. )
65         fi
66
67         insinto "${MY_HTDOCSDIR#${EPREFIX}}"
68         doins -r django/contrib/admin/static/admin/.
69         distutils-r1_python_install_all
70 }
71
72 pkg_postinst() {
73         elog "A copy of the admin media is available to webapp-config for installation in a"
74         elog "webroot, as well as the traditional location in python's site-packages dir"
75         elog "for easy development."
76         webapp_pkg_postinst
77 }