# $Id$ # needed for mbindir() sminclude mtools # get the major.minor current installed python version # -> ex 2.4 get_python_version() { # PYVER="$(python -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" PYVER=$(python -c "import sys ; print sys.version[:3]") [[ -z ${PYVER} ]] && return 1 echo "${PYVER}" return 0 } get_python_libdir() { local pylib pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') echo "${pylib}" return 0 } python_src_prepare() { munpack ${SRCFILE} || die } python_src_compile() { cd ${SRCDIR} if [[ -e setup.py ]] then python setup.py build "$@" || die elif [[ -e waf ]] then python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) "$@" || die python waf build "$@" || die elif [[ -e configure ]] then mconfigure "$@" || die mmake || die else mmake || die fi } python_src_install() { cd ${SRCDIR} if [[ -e setup.py ]] then python setup.py install --no-compile --root $(mbindir) "$@" || die elif [[ -e waf ]] then python waf install --destdir="$(mbindir)" "$@" || die else mmake DESTDIR=$(mbindir) install || die fi local i for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ FAQ LICENSE NEWS README TODO do if [ -f ${SRCDIR}/${i} ] then minstalldocs ${i} || die fi done } export_inherits python src_prepare src_compile src_install