# $Id$ SDEPEND="${SDEPEND} >= dev-lang/python-2.7" # get the major.minor current installed python version # -> ex 2.4 get_python_version() { local pyver # 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()') [[ -z ${pylib} ]] && return 1 echo "${pylib}" return 0 } get_python_includedir() { local pyinc pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') [[ -z ${pyinc} ]] && return 1 echo "${pyinc}" return 0 } python_src_prepare() { munpack ${SRCFILE} || die } python_docompile() { 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 elif [[ -e install.py ]] then echo "install.py found - nothing to compile here." else mmake || die fi } python_doinstall() { if [[ -e setup.py ]] then python setup.py install --no-compile --root ${BINDIR} $@ || die elif [[ -e waf ]] then python waf install --destdir=${BINDIR} $@ || die elif [[ -e install.py ]] then python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die else mmake DESTDIR=${BINDIR} install || die fi } python_src_compile() { cd ${SRCDIR} python_docompile || die } python_multilib_src_compile() { local abi local saved_SRCDIR="${SRCDIR}" for abi in ${MULTILIB_ABIS} do SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" cd ${SRCDIR} abi-${abi} python_docompile || die done SRCDIR="${saved_SRCDIR}" } python_src_check() { return 0 } python_src_install() { cd ${SRCDIR} python_doinstall || die 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 } python_multilib_src_install() { local abi local saved_SRCDIR="${SRCDIR}" for abi in ${MULTILIB_ABIS} do SRCDIR="${saved_SRCDIR}-${abi}/${SRCSUBDIR}" cd ${SRCDIR} abi-${abi} python_doinstall || die local i for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ FAQ LICENSE NEWS README TODO do if [ -f ${SRCDIR}/${i} ] then oldminstalldocs ${i} || die fi done done SRCDIR="${saved_SRCDIR}" } export_inherits python src_prepare src_check if [[ ${MULTILIB_BUILD} = true ]] then export_inherits python_multilib src_compile src_install else export_inherits python src_compile src_install fi