--- trunk/core/include/python.sminc 2008/10/10 13:29:42 2 +++ branches/magellan-next/include/python.sminc 2011/12/01 18:46:32 9472 @@ -1,4 +1,4 @@ -# $Header: /magellan-cvs/smage/include/python.sminc,v 1.4 2007/01/23 20:46:41 niro Exp $ +# $Id$ # get the major.minor current installed python version # -> ex 2.4 @@ -14,26 +14,71 @@ 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()') echo "${pylib}" return 0 } +get_python_includedir() +{ + local pyinc + pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') + 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 setup.py build "$@" || die + python_docompile || die } python_src_install() { cd ${SRCDIR} - python setup.py install --no-compile --root ${BINDIR} "$@" || die + python_doinstall || die local i for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \