1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_4 pypy )
8 PYTHON_REQ_USE='sqlite?,threads(+)'
9 WEBAPP_NO_AUTO_INSTALL="yes"
11 inherit bash-completion-r1 distutils-r1 eutils versionator webapp
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"
22 IUSE="doc sqlite test"
26 dev-python/setuptools[${PYTHON_USEDEP}]
27 doc? ( >=dev-python/sphinx-1.0.7[${PYTHON_USEDEP}] )
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}]
37 # dev-python/bcrypt[${PYTHON_USEDEP}]
38 # dev-python/selenium[${PYTHON_USEDEP}]
40 S="${WORKDIR}/${MY_P}"
42 WEBAPP_MANUAL_SLOT="yes"
45 "${FILESDIR}"/${PN}-1.5-py3tests.patch
46 "${FILESDIR}"/${PN}-1.6-objects.patch
47 "${FILESDIR}"/${PN}-1.6.10-bashcomp.patch
54 python_prepare_all() {
55 # Disable tests requiring network connection.
57 -e "s:test_sensitive_cookie_not_cached:_&:g" \
58 -i tests/cache/tests.py || die
60 distutils-r1_python_prepare_all
62 python_compile_all() {
63 use doc && emake -C docs html
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}"
74 distutils-r1_src_install
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
86 python_install_all() {
87 newbashcomp extras/django_bash_completion ${PN}-admin
88 bashcomp_alias ${PN}-admin django-admin.py
91 rm -fr docs/_build/html/_sources || die
92 local HTML_DOCS=( docs/_build/html/. )
95 insinto "${MY_HTDOCSDIR#${EPREFIX}}"
96 doins -r django/contrib/admin/static/admin/.
97 distutils-r1_python_install_all
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."