summaryrefslogtreecommitdiff
blob: ae32358f98c700b2c782ab5509f67c1abe92f12e (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/astng/astng-0.17.0.ebuild,v 1.5 2007/06/24 20:35:14 dev-zero Exp $

NEED_PYTHON=2.1

inherit distutils eutils multilib

DESCRIPTION="Abstract Syntax Tree New Generation for logilab packages"
SRC_URI="ftp://ftp.logilab.org/pub/astng/logilab-${P}.tar.gz"
HOMEPAGE="http://www.logilab.org/projects/astng/"

IUSE=""
SLOT="0"
KEYWORDS="amd64 ~ia64 ppc ~ppc64 ~sparc x86"
LICENSE="GPL-2"

DEPEND=">=dev-python/logilab-common-0.13-r1"
RDEPEND="${DEPEND}"

S="${WORKDIR}/logilab-${P}"

src_unpack() {
	unpack ${A}
	cd "${S}"

	# Skip a failing test.
	epatch "${FILESDIR}/${PN}-0.16.1-skip-gobject-test.patch"

	# Fix a typo (?)
	epatch "${FILESDIR}/${P}-test-fixes.patch"
}

src_install() {
	distutils_src_install
	python_version
	# we need to remove this file because it collides with the one
	# from logilab-common (which we depend on).
	rm "${D}/usr/$(get_libdir)/python${PYVER}/site-packages/logilab/__init__.py"
}

src_test() {
	python_version

	# Do a temporary install.
	local spath="usr/$(get_libdir)/python${PYVER}/site-packages/"

	# This is a hack to make tests work without installing to the live
	# filesystem. We copy part of the logilab site-packages to a temporary
	# dir, install there, and run from there.
	mkdir -p "${T}/test/${spath}/logilab"
	cp -r "/${spath}/logilab/common" "${T}/test/${spath}/logilab" \
		|| die "copying logilab-common failed!"

	"${python}" setup.py install --root="${T}/test" || die "test copy failed"

	# Use a hacked up copy of pytest that exits nonzero on failure.
	sed -e 's/exitafter=False/exitafter=True/' \
		< "/usr/bin/pytest" > "${T}/pytest" || die "sed failed"

	# Pytest picks up tests relative to the current dir, so cd in.
	pushd "${T}/test/${spath}/logilab/astng" >/dev/null
	PYTHONPATH="${T}/test/${spath}" "${python}" "${T}/pytest" -v \
		|| die "tests failed"
	popd >/dev/null
	rm -rf "${T}/test"
}