summaryrefslogtreecommitdiff
blob: 3d645099363196c0fac7294cf8f775f068bc3165 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/astng/astng-0.19.0.ebuild,v 1.2 2009/08/25 14:51:27 arfrever Exp $

EAPI="2"
SUPPORT_PYTHON_ABIS="1"

inherit distutils

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

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

RDEPEND=">=dev-python/logilab-common-0.39.0"
DEPEND="${RDEPEND}
	test? ( >=dev-python/egenix-mx-base-3.0.0 )"

RESTRICT_PYTHON_ABIS="3*"

PYTHON_MODNAME="logilab"

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

src_test() {
	testing() {
		local sdir="${T}/test/$(python_get_sitedir)"

		# 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 "${sdir}/logilab" || die
		cp -r "$(python_get_sitedir)/logilab/common" "${sdir}/logilab" || die "copying logilab-common failed!"

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

		# Pytest picks up tests relative to the current dir, so cd in.
		pushd "${sdir}/logilab/astng" > /dev/null || die
		PYTHONPATH="${sdir}" pytest -v || die "tests failed"
		popd > /dev/null
	}
	python_execute_function testing
}

src_install() {
	distutils_src_install

	deletion_of_unneeded_files() {
		local sdir="${D}/$(python_get_sitedir)/logilab"

		# we need to remove this file because it collides with the one
		# from logilab-common (which we depend on).
		# Bug 111970 and bug 223025
		rm "${sdir}/__init__.py" || die

		# Remove unittests since they're just needed during build-time
		rm -rf "${sdir}/astng/test" || die
	}
	python_execute_function --action-message 'Deletion of unneeded files with Python ${PYTHON_ABI}' deletion_of_unneeded_files
}