summaryrefslogtreecommitdiff
blob: 1fca3c8f8937cee2d68de3d64a13f4959895155e (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/cherrypy/cherrypy-3.1.2.ebuild,v 1.7 2010/04/02 18:49:55 arfrever Exp $

EAPI="3"
SUPPORT_PYTHON_ABIS="1"

inherit distutils eutils versionator

MY_PV=$(delete_version_separator _)
MY_P="CherryPy-${MY_PV}"

DESCRIPTION="CherryPy is a pythonic, object-oriented web development framework."
HOMEPAGE="http://www.cherrypy.org/ http://pypi.python.org/pypi/CherryPy"
SRC_URI="http://download.cherrypy.org/${PN}/${MY_PV}/${MY_P}.tar.gz
	http://download.cherrypy.org/${PN}/${MY_PV}/${MY_P}-py3.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc"

DEPEND=""
RDEPEND=""

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${MY_P}-py3.tar.gz
	mv "${S}" "${S}-py3"
	unpack ${MY_P}.tar.gz
}

src_prepare() {
	patching() {
		[[ "${PYTHON_ABI}" != 3.* ]] && return
		cd "${S}-py3"
		epatch "${FILESDIR}/${MY_P}-py3.patch"
	}
	python_execute_function --action-message 'Applying patches with $(python_get_implementation) $(python_get_version)' patching
}

distutils_src_compile_pre_hook() {
	if [[ "${PYTHON_ABI:0:1}" == "3" ]]; then
		cd "${S}-py3"
	else
		cd "${S}"
	fi
}

distutils_src_test_pre_hook() {
	if [[ "${PYTHON_ABI:0:1}" == "3" ]]; then
		cd "${S}-py3"
	else
		cd "${S}"
	fi
}

distutils_src_install_pre_hook() {
	if [[ "${PYTHON_ABI:0:1}" == "3" ]]; then
		cd "${S}-py3"
	else
		cd "${S}"
	fi
}

src_test() {
	testing() {
		if [[ "${PYTHON_ABI:0:1}" == "3" ]]; then
			cd "${S}-py3"
		else
			cd "${S}"
		fi
		PYTHONPATH="build-${PYTHON_ABI}/lib" "$(PYTHON)" cherrypy/test/test.py --dumb
	}
	python_execute_function testing
}

src_install() {
	distutils_src_install

	if use doc; then
		insinto "/usr/share/doc/${PF}"
		doins -r cherrypy/tutorial
	fi
}