summaryrefslogtreecommitdiff
blob: 8b50977ca3693f7da3327159ce218ec8a0b717f1 (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
68
69
70
71
72
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/reportlab/reportlab-2.1.ebuild,v 1.9 2008/07/17 18:59:13 aballier Exp $

NEED_PYTHON=2.4

inherit distutils versionator

MY_PV="$(replace_all_version_separators _)"

DESCRIPTION="Tools for generating printable PDF documents from any data source."
HOMEPAGE="http://www.reportlab.org/"
SRC_URI="http://www.reportlab.org/ftp/ReportLab_${MY_PV}.tgz"
LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
IUSE="doc examples"

DEPEND="sys-libs/zlib
	dev-python/imaging
	media-fonts/ttf-bitstream-vera"
RDEPEND="${DEPEND}"

S=${WORKDIR}/${PN}_${MY_PV}/${PN}

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

	epatch "${FILESDIR}/${PV}-tests_report_failure.patch"
	epatch "${FILESDIR}/${PV}-test_fix.patch"
	epatch "${FILESDIR}/${PV}-test_no_network.patch"

	sed -i \
		-e "/'docs/d" -e "/'test/d" \
		-e "/'fonts/d" -e "/demos/d" \
		setup.py || die "sed failed"

	sed -i \
		-e 's|/usr/lib/X11/fonts/TrueType/|/usr/share/fonts/ttf-bitstream-vera/|' \
		-e 's|/usr/local/Acrobat|/opt/Acrobat|g' \
		-e 's|%(HOME)s/fonts|%(HOME)s/.fonts|g' \
		-e 's|%(REPORTLAB_DIR)s/../../fonts|/usr/share/fonts|' \
		rl_config.py || die "sed failed"

	# A rather useless test which rebuilds the docs and fails
	# since it calls python using os.system but doesn't pass
	# the PYTHONPATH env-variable along
	rm "${S}/test/test_docs_build.py"
	# ... and remove yet another broken test
	rm "${S}/test/test_platypus_paragraphs.py"
}

src_install() {
	distutils_src_install

	if use doc ; then
		insinto /usr/share/doc/${PF}
		doins -r docs/*
	fi
	if use examples ; then
		insinto /usr/share/doc/${PF}
		doins -r demos
		insinto /usr/share/doc/${PF}/tools/pythonpoint
		doins -r tools/pythonpoint/demos
	fi
}

src_test() {
	cd "${S}/test"
	PYTHONPATH="../.." ${python} runAll.py || die "tests failed"
}