summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/zpkg.eclass')
-rw-r--r--eclass/zpkg.eclass95
1 files changed, 95 insertions, 0 deletions
diff --git a/eclass/zpkg.eclass b/eclass/zpkg.eclass
new file mode 100644
index 0000000..15d0f94
--- /dev/null
+++ b/eclass/zpkg.eclass
@@ -0,0 +1,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