summaryrefslogtreecommitdiff
path: root/dev-python/django-auditlog/django-auditlog-2.3.0.ebuild
blob: f7434c48fd862a3a6dde506482ad0e42dee17280 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{8..12} )

inherit distutils-r1

DESCRIPTION="Audit log app for Django"
HOMEPAGE="https://github.com/jazzband/django-auditlog"
SRC_URI="https://github.com/jazzband/${PN}/archive/v${PV}.tar.gz -> ${P}.gh.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"

RDEPEND="dev-python/django[${PYTHON_USEDEP}]"
DEPEND="${RDEPEND}"
BDEPEND="
	dev-python/python-dateutil[${PYTHON_USEDEP}]
	dev-python/setuptools-scm[${PYTHON_USEDEP}]
	doc? (
		dev-python/psycopg:2[${PYTHON_USEDEP}]
	)
	test? (
		dev-db/postgresql[server]
		dev-python/freezegun[${PYTHON_USEDEP}]
	)
"

export SETUPTOOLS_SCM_PRETEND_VERSION=${PV}

distutils_enable_sphinx docs/source \
	dev-python/sphinx-rtd-theme

python_test() {
	local db="${T}/pgsql"

	initdb --username=postgres -D "${db}" || die
	pg_ctl -w -D "${db}" start \
		-o "-h '127.0.0.1' -p 5432 -k '${T}'" || die
	psql -h "${T}" -U postgres -d postgres \
		-c "ALTER ROLE postgres WITH PASSWORD '';" || die
	createdb -h "${T}" -U postgres auditlog || die

	"${EPYTHON}" -m django test -v2 --settings=auditlog_tests.test_settings || die "Tests fail with ${EPYTHON}"

	pg_ctl -w -D "${db}" stop || die
}