--- trunk/include/python.sminc 2014/04/03 23:08:50 22416 +++ trunk/include/python.sminc 2017/10/11 09:27:47 29773 @@ -1,15 +1,25 @@ # $Id$ -SDEPEND="${SDEPEND} - >= dev-lang/python-2.7" +# simulate the old behavior +if [[ -z ${MAGE_PYTHON_EXEC} ]] +then + MAGE_PYTHON_EXEC="python" + + SDEPEND="${SDEPEND} + >= dev-lang/python-2.7" +fi +if [[ -z ${MAGE_PYTHON_BUILD_VERSIONS} ]] +then + MAGE_PYTHON_BUILD_VERSIONS="single" +fi # get the major.minor current installed python version # -> ex 2.4 mget-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]") +# pyver="$(${MAGE_PYTHON_EXEC} -V 2>&1 | cut -d' ' -f2 | cut -d. -f1-2)" + pyver=$(${MAGE_PYTHON_EXEC} -c "import sys ; (print sys.version[:3])") [[ -z ${pyver} ]] && return 1 echo "${pyver}" return 0 @@ -18,7 +28,7 @@ mget-python-libdir() { local pylib - pylib=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_lib()') + pylib=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_lib())') [[ -z ${pylib} ]] && return 1 echo "${pylib}" return 0 @@ -27,7 +37,7 @@ mget-python-includedir() { local pyinc - pyinc=$(python -c 'from distutils import sysconfig; print sysconfig.get_python_inc()') + pyinc=$(${MAGE_PYTHON_EXEC} -c 'from distutils import sysconfig; print (sysconfig.get_python_inc())') [[ -z ${pyinc} ]] && return 1 echo "${pyinc}" return 0 @@ -59,11 +69,11 @@ { if [[ -e setup.py ]] then - python setup.py build $@ || die + ${MAGE_PYTHON_EXEC} setup.py build $@ || die elif [[ -e waf ]] then - python waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die - python waf build $@ || die + ${MAGE_PYTHON_EXEC} waf configure --prefix=/usr --libdir=/usr/$(mlibdir) $@ || die + ${MAGE_PYTHON_EXEC} waf build $@ || die elif [[ -e configure ]] then mconfigure $@ || die @@ -80,13 +90,13 @@ { if [[ -e setup.py ]] then - python setup.py install --no-compile --root ${BINDIR} $@ || die + ${MAGE_PYTHON_EXEC} setup.py install --no-compile --root ${BINDIR} $@ || die elif [[ -e waf ]] then - python waf install --destdir=${BINDIR} $@ || die + ${MAGE_PYTHON_EXEC} waf install --destdir=${BINDIR} $@ || die elif [[ -e install.py ]] then - python install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die + ${MAGE_PYTHON_EXEC} install.py --prefix=/usr --files-only --destdir=${BINDIR} $@ || die else mmake DESTDIR=${BINDIR} install || die fi