dev-perl/Class-Inspector: amd64 stable
[gentoo.git] / dev-python / django / django-1.4.22.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 )
7 PYTHON_REQ_USE='sqlite?,threads(+)'
8
9 inherit bash-completion-r1 distutils-r1 eutils 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="sqlite test"
21
22 RDEPEND=""
23 DEPEND="${RDEPEND}
24         dev-python/setuptools[${PYTHON_USEDEP}]
25         test? (
26                 $(python_gen_impl_dep sqlite)
27                 dev-python/docutils[${PYTHON_USEDEP}]
28                 <dev-python/numpy-1.9[$(python_gen_usedep 'python*')]
29                 dev-python/pillow[${PYTHON_USEDEP}]
30                 dev-python/pytz[${PYTHON_USEDEP}]
31                 dev-python/pyyaml[${PYTHON_USEDEP}]
32                 dev-python/pillow[${PYTHON_USEDEP}]
33                 )"
34
35 #               app-text/pytextile[${PYTHON_USEDEP}]
36 #               dev-python/markdown[${PYTHON_USEDEP}]
37 #               dev-python/selenium[${PYTHON_USEDEP}]
38 #               dev-python/py-bcrypt[${PYTHON_USEDEP}]
39
40 S="${WORKDIR}/${MY_P}"
41
42 WEBAPP_MANUAL_SLOT="yes"
43
44 PATCHES=(
45         "${FILESDIR}"/${PN}-1.4.19-bashcomp.patch
46 )
47
48 python_prepare_all() {
49         # Disable tests requiring network connection.
50         sed \
51                 -e "s/test_correct_url_value_passes/_&/" \
52                 -e "s/test_correct_url_with_redirect/_&/" \
53                 -i tests/modeltests/validation/tests.py || die
54         sed \
55                 -e "s/test_urlfield_3/_&/" \
56                 -e "s/test_urlfield_4/_&/" \
57                 -e "s/test_urlfield_10/_&/" \
58                 -i tests/regressiontests/forms/tests/fields.py || die
59
60         distutils-r1_python_prepare_all
61 }
62
63 python_test() {
64         # Tests have non-standard assumptions about PYTHONPATH,
65         # and don't work with ${BUILD_DIR}/lib.
66         PYTHONPATH=. "${PYTHON}" tests/runtests.py --settings=test_sqlite -v2 \
67                 || die "Tests fail with ${EPYTHON}"
68 }
69
70 src_install() {
71         distutils-r1_src_install
72         webapp_src_install
73
74         elog "Additional Backend support can be enabled via"
75         optfeature "MySQL backend support in python 2.7 only" dev-python/mysql-python
76         optfeature "MySQL backend support in python 2.7 - 3.4" dev-python/mysql-connector-python
77         optfeature "PostgreSQL backend support" dev-python/psycopg:2
78         optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
79         optfeature "ImageField Support" dev-python/pillow
80         echo ""
81 }
82
83 python_install_all() {
84         newbashcomp extras/django_bash_completion ${PN}-admin
85         bashcomp_alias ${PN}-admin django-admin.py
86
87         insinto "${MY_HTDOCSDIR#${EPREFIX}}"
88         doins -r django/contrib/admin/static/admin/.
89         distutils-r1_python_install_all
90 }
91
92 pkg_postinst() {
93         elog "A copy of the admin media is available to"
94         elog "webapp-config for installation in a webroot,"
95         elog "as well as the traditional location in python's"
96         elog "site-packages dir for easy development"
97         elog
98         ewarn "If you build Django ${PV} without USE=\"vhosts\""
99
100         # XXX: call webapp_pkg_postinst? the old ebuild didn't do that...
101         ewarn "webapp-config will automatically install the"
102         ewarn "admin media into the localhost webroot."
103 }