Stable for x86, wrt bug #364053
[wtk-overlay.git] / south-0.7.5.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header$
4
5 EAPI="4"
6
7 PYTHON_DEPEND="2"
8 SUPPORT_PYTHON_ABIS="1"
9 RESTRICT_PYTHON_ABIS="2.5 3.*"
10
11 inherit distutils
12
13 DESCRIPTION="Intelligent schema migrations for Django apps."
14 HOMEPAGE="http://south.aeracode.org/"
15 SRC_URI="https://bitbucket.org/andrewgodwin/south/get/${PV}.tar.gz -> ${P}.tar.gz"
16
17 LICENSE="Apache-2.0"
18 SLOT="0"
19 KEYWORDS="amd64 x86"
20 IUSE="doc"
21
22 RDEPEND="dev-python/django"
23 DEPEND="${RDEPEND}
24         dev-python/setuptools
25         doc? ( dev-python/sphinx dev-python/jinja )"
26
27 # we are setting up the tests, but they fail
28 RESTRICT="test"
29
30 src_unpack() {
31         default
32         mv "${WORKDIR}"/*-south-* "${S}"
33 }
34
35 src_compile() {
36         distutils_src_compile
37
38         use doc && emake -C docs html
39 }
40
41 src_install() {
42         distutils_src_install
43
44         use doc && dohtml -r docs/_build/html/*
45 }
46
47 pkg_postinst() {
48         distutils_pkg_postinst
49         elog "In order to use the south schema migrations for your Django project,"
50         elog "just add 'south' to your INSTALLED_APPS in the settings.py file."
51         elog "manage.py will now automagically offer the new functions."
52 }
53
54 src_test() {
55         testing() {
56                 mkdir -p "${T}/test-${PYTHON_ABI}"
57                 cd "${T}/test-${PYTHON_ABI}"
58
59                 django-admin.py-${PYTHON_ABI} startproject southtest || die "setting up test env failed"
60                 cd southtest
61                 sed -i \
62                         -e "/^INSTALLED_APPS/a\    'south'," \
63                         -e 's/\(django.db.backends.\)/\1sqlite3/' \
64                         -e "s/\(NAME': '\)/\1test.db/" \
65                         southtest/settings.py || die "sed failed"
66                 echo "SKIP_SOUTH_TESTS=False" >> southtest/settings.py
67                 PYTHONPATH="${S}/build-${PYTHON_ABI}/lib:${S}/south/tests" "$(PYTHON)" manage.py test south || die "tests failed"
68         }
69         python_execute_function testing
70 }