dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / django / django-1.6.11.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=5
5
6 PYTHON_COMPAT=( python2_7 python3_4 pypy )
7
8 PYTHON_REQ_USE='sqlite?,threads(+)'
9 WEBAPP_NO_AUTO_INSTALL="yes"
10
11 inherit bash-completion-r1 distutils-r1 eutils versionator webapp
12
13 MY_P="Django-${PV}"
14
15 DESCRIPTION="High-level Python web framework"
16 HOMEPAGE="https://www.djangoproject.com/ https://pypi.python.org/pypi/Django"
17 SRC_URI="https://www.djangoproject.com/m/releases/$(get_version_component_range 1-2)/${MY_P}.tar.gz"
18
19 LICENSE="BSD"
20 SLOT="0"
21 KEYWORDS=""
22 IUSE="doc sqlite test"
23
24 RDEPEND=""
25 DEPEND="${RDEPEND}
26         dev-python/setuptools[${PYTHON_USEDEP}]
27         doc? ( >=dev-python/sphinx-1.0.7[${PYTHON_USEDEP}] )
28         test? (
29                 $(python_gen_impl_dep sqlite)
30                 dev-python/docutils[${PYTHON_USEDEP}]
31                 <dev-python/numpy-1.9[$(python_gen_usedep 'python*')]
32                 dev-python/pillow[${PYTHON_USEDEP}]
33                 dev-python/pyyaml[${PYTHON_USEDEP}]
34                 dev-python/pytz[${PYTHON_USEDEP}]
35                 )"
36
37 #               dev-python/bcrypt[${PYTHON_USEDEP}]
38 #               dev-python/selenium[${PYTHON_USEDEP}]
39
40 S="${WORKDIR}/${MY_P}"
41
42 WEBAPP_MANUAL_SLOT="yes"
43
44 PATCHES=(
45         "${FILESDIR}"/${PN}-1.5-py3tests.patch
46         "${FILESDIR}"/${PN}-1.6-objects.patch
47         "${FILESDIR}"/${PN}-1.6.10-bashcomp.patch
48 )
49
50 pkg_setup() {
51         webapp_pkg_setup
52 }
53
54 python_prepare_all() {
55         # Disable tests requiring network connection.
56         sed \
57                 -e "s:test_sensitive_cookie_not_cached:_&:g" \
58                 -i tests/cache/tests.py || die
59
60         distutils-r1_python_prepare_all
61 }
62 python_compile_all() {
63         use doc && emake -C docs html
64 }
65
66 python_test() {
67         # Tests have non-standard assumptions about PYTHONPATH,
68         # and don't work with ${BUILD_DIR}/lib.
69         PYTHONPATH=. "${PYTHON}" tests/runtests.py --settings=test_sqlite -v2 \
70                 || die "Tests fail with ${EPYTHON}"
71 }
72
73 src_install() {
74         distutils-r1_src_install
75         webapp_src_install
76
77         elog "Additional Backend support can be enabled via"
78         optfeature "MySQL backend support in python 2.7 only" dev-python/mysql-python
79         optfeature "MySQL backend support in python 2.7 - 3.4" dev-python/mysql-connector-python
80         optfeature "PostgreSQL backend support" dev-python/psycopg:2
81         optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
82         optfeature "ImageField Support" dev-python/pillow
83         echo ""
84 }
85
86 python_install_all() {
87         newbashcomp extras/django_bash_completion ${PN}-admin
88         bashcomp_alias ${PN}-admin django-admin.py
89
90         if use doc; then
91                 rm -fr docs/_build/html/_sources || die
92                 local HTML_DOCS=( docs/_build/html/. )
93         fi
94
95         insinto "${MY_HTDOCSDIR#${EPREFIX}}"
96         doins -r django/contrib/admin/static/admin/.
97         distutils-r1_python_install_all
98 }
99
100 pkg_postinst() {
101         elog "A copy of the admin media is available to webapp-config for installation in a"
102         elog "webroot, as well as the traditional location in python's site-packages dir"
103         elog "for easy development."
104         webapp_pkg_postinst
105 }