summaryrefslogtreecommitdiff
blob: 15d0f94bb5a5ee6cb344ef44c2602e23f91a0ef9 (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
87
88
89
90
91
92
93
94
95
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# Author: Gunnar Wrobel <php@gunnarwrobel.de>
# Based on: eclipse-ext.eclass

inherit python eutils multilib

DEPEND="net-zope/zope 
        net-zope/zpkg"

# Must be listed in oldest->newest order!
known_zope_slots="3.1.0"

ZS_DIR=${ROOT%/}/usr/$(get_libdir)

# ---------------------------------------------------------------------------
# @private _find-optimum-slot
#
# Look for a given SLOT. If not found return the highest SLOT
# available.
#
# @param $1 - SLOT of Zope that is desired
# @return 0 - all is well, non-zero otherwise
# ---------------------------------------------------------------------------
function _find-optimum-slot {

	local found=false

	for x in ${known_zope_slots} ; do

		if [ "x${1}" == "x${x}" ] ; then
			found=true
		fi
		if [ "${found}" == "true" ] && [ -d ${ZS_DIR}/zope-${x} ] ; then
			ZOPE_SLOT=${x}
			return 0
		fi

		if [ -d ${ZS_DIR}/zope-${x} ] ; then
			ZOPE_SLOT=${x}
		fi
	done

}

# ---------------------------------------------------------------------------
# @public zope-require-slot
#
# Ensure that a Zope version is actually available for the given slot;
# sets internal state to install for selected slot.
#
# @param $1 - SLOT of Zope that required for this ebuild
# alternatively
# @return 0 - all is well, non-zero otherwise
# ---------------------------------------------------------------------------
function zope-require-slot {

	_find-optimum-slot $1

	if [ "${ZOPE_SLOT}" != "${1}" ] ; then
		eerror "Slot ${1} could not be satisfied. ${ZOPE_SLOT} is the highest version reported."
	fi

	return 0
}

zpkg_src_compile() {

	python setup.py build "$@" || die "compilation failed"
}

zpkg_src_install() {

	einfo "${ZS_DIR}"

	if [ -z "${ZOPE_SLOT}" ] ; then
		_find-optimum-slot
		if [ -z "${ZOPE_SLOT}" ] ; then
			die "Cannot find any Zope version"
		fi
	fi

	ZOPE_LOC=${ZS_DIR}/zope-${ZOPE_SLOT}

	python setup.py install                                 \
		--install-purelib ${ZOPE_LOC}/lib/python/           \
		--install-data ${ZOPE_LOC}                          \
		--root=${D}                                         \
		--no-compile "$@" || die "Installation failed"

}

EXPORT_FUNCTIONS src_compile src_install