--- branches/magellan-next/include/python.sminc 2011/07/12 17:20:55 8123 +++ trunk/include/python.sminc 2014/03/06 08:40:01 21029 @@ -1,62 +1,104 @@ -# $Header: /magellan-cvs/smage/include/python.sminc,v 1.4 2007/01/23 20:46:41 niro Exp $ +# $Id$ + +SDEPEND="${SDEPEND} + >= dev-lang/python-2.7" # 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}" + 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_version()') + 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_src_compile() +python_docompile() { - cd ${SRCDIR} - if [[ -e setup.py ]] then - python setup.py build "$@" || die + python setup.py build $@ || die elif [[ -e waf ]] then - python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) "$@" || die - python waf build "$@" || die + python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die + python waf build $@ || die elif [[ -e configure ]] then - mconfigure "$@" || die + mconfigure $@ || die mmake || die + elif [[ -e install.py ]] + then + echo "install.py found - nothing to compile here." else mmake || die fi } -python_src_install() +python_doinstall() { - cd ${SRCDIR} - if [[ -e setup.py ]] then - python setup.py install --no-compile --root ${BINDIR} "$@" || die + python setup.py install --no-compile --root ${BINDIR} $@ || die elif [[ -e waf ]] then - python waf install --destdir="${BINDIR}" "$@" || die + 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_install() +{ + cd ${SRCDIR} + python_doinstall || die local i for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ @@ -69,4 +111,34 @@ done } -export_inherits python src_prepare src_compile src_install +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