1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
7 PYTHON_REQ_USE='sqlite?,threads(+)'
8 WEBAPP_NO_AUTO_INSTALL="yes"
10 inherit bash-completion-r1 distutils-r1 eutils eapi7-ver webapp
15 DESCRIPTION="High-level Python web framework"
16 HOMEPAGE="https://www.djangoproject.com/ https://pypi.org/project/Django/"
18 https://www.djangoproject.com/m/releases/$(ver_cut 1-2)/${MY_P}.tar.gz
19 mirror://pypi/${MY_PN:0:1}/${MY_PN}/${MY_P}.tar.gz
23 # admin fonts: Roboto (media-fonts/roboto)
24 LICENSE+=" Apache-2.0"
25 # admin icons, jquery, xregexp.js
28 KEYWORDS="amd64 ~arm64 ~ia64 ~ppc ~ppc64 x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
29 IUSE="doc sqlite test"
30 RESTRICT="!test? ( test )"
34 dev-python/pytz[${PYTHON_USEDEP}]
35 dev-python/setuptools[${PYTHON_USEDEP}]
36 doc? ( >=dev-python/sphinx-1.0.7[${PYTHON_USEDEP}] )
38 $(python_gen_impl_dep sqlite)
39 dev-python/docutils[${PYTHON_USEDEP}]
40 dev-python/numpy[$(python_gen_usedep 'python*')]
41 dev-python/pillow[${PYTHON_USEDEP}]
42 dev-python/pyyaml[${PYTHON_USEDEP}]
43 dev-python/mock[${PYTHON_USEDEP}]
44 virtual/python-enum34[${PYTHON_USEDEP}]
47 S="${WORKDIR}/${MY_P}"
49 WEBAPP_MANUAL_SLOT="yes"
52 "${FILESDIR}"/${PN}-1.9-bashcomp.patch
59 python_prepare_all() {
60 # Prevent d'loading in the doc build
61 sed -e '/^ "sphinx.ext.intersphinx",/d' -i docs/conf.py || die
63 distutils-r1_python_prepare_all
66 python_compile_all() {
67 use doc && emake -C docs html
71 # Tests have non-standard assumptions about PYTHONPATH,
72 # and don't work with ${BUILD_DIR}/lib.
73 PYTHONPATH=. "${PYTHON}" tests/runtests.py --settings=test_sqlite -v2 --parallel 1 \
74 || die "Tests fail with ${EPYTHON}"
77 python_install_all() {
78 newbashcomp extras/django_bash_completion ${PN}-admin
79 bashcomp_alias ${PN}-admin django-admin.py
82 rm -fr docs/_build/html/_sources || die
83 local HTML_DOCS=( docs/_build/html/. )
86 insinto "${MY_HTDOCSDIR#${EPREFIX}}"
87 doins -r django/contrib/admin/static/admin/.
88 distutils-r1_python_install_all
92 distutils-r1_src_install
97 elog "Additional Backend support can be enabled via"
98 optfeature "MySQL backend support in python 2.7 only" dev-python/mysql-python
99 optfeature "MySQL backend support in python 2.7 - 3.4" dev-python/mysqlclient
100 optfeature "PostgreSQL backend support" dev-python/psycopg:2
102 elog "Other features can be enhanced by"
103 optfeature "GEO Django" sci-libs/gdal[geos]
104 optfeature "Memcached support" dev-python/pylibmc dev-python/python-memcached
105 optfeature "ImageField Support" dev-python/pillow
106 optfeature "Password encryption" dev-python/bcrypt
107 optfeature "High-level abstractions for Django forms" dev-python/django-formtools
109 elog "A copy of the admin media is available to webapp-config for installation in a"
110 elog "webroot, as well as the traditional location in python's site-packages dir"
111 elog "for easy development."