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