# $Id: python-2.6.3-r2.smage2 3627 2009-10-27 15:43:35Z niro $ PNAME="python" PVER="2.6.3" PBUILD="r2" PCATEGORIE="dev-lang" STATE="unstable" DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language." HOMEPAGE="http://www.python.org/" DEPEND=">= virtual/glibc >= sys-libs/ncurses-5.7 >= sys-libs/zlib-1.2 >= dev-libs/expat-2 >= dev-libs/openssl-0.9.8 >= sys-libs/readline-6.0 >= dev-db/sqlite-3.6" SDEPEND=">= sys-apps/sed-4" SRCFILE="${PNAME/py/Py}-${PVER/.0}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME/py/Py}-${PVER/.0}" PYVER="${PVER:0:3}" # vars needed in magefile mPYVER="${PYVER}" SPECIAL_VARS="mPYVER" # disabled modules (needs the gentoo_py_dontcompile patch) export PYTHON_DISABLE_MODULES="gdbm dbm bsddb _tkinter" || die # force usage of our CFLAGS export OPT="${CFLAGS}" sminclude mtools # uses PYVER and sometimes PVER; so keep both SRC_URI=( http://www.python.org/ftp/python/${PYVER}/${SRCFILE} http://www.python.org/ftp/python/${PVER}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-2.6.0-gentoo_py_dontcompile.patch mirror://${PNAME}/${PNAME}-2.4-disable_modules_and_ssl.patch mirror://${PNAME}/${PNAME}-2.5.0-mimetypes-apache.patch mirror://${PNAME}/${PNAME}-2.6.0-lib64-2.patch ) # sed line: on 2 digits add an zero: 2.6 -> 2.6.0 UP2DATE="updatecmd ${HOMEPAGE}/download/releases/ | grep 'Python .*(.*)' | sed 's/.*Python\ \([0-9].*\) (.*/\1/g;s/\([0-9]\.[0-9]\$\)/\1.0/;q'" src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # adds support for PYTHON_DONTCOMPILE shell environment to # supress automatic generation of .pyc and .pyo files mpatch ${PNAME}-2.6.0-gentoo_py_dontcompile.patch || die mpatch ${PNAME}-2.4-disable_modules_and_ssl.patch || die mpatch ${PNAME}-2.5.0-mimetypes-apache.patch || die if [[ $(mlibdir) = lib64 ]] then mpatch ${PNAME}-2.6.0-lib64-2.patch || die fi } src_compile() { cd ${SRCDIR} mconfigure \ --with-fpectl \ --enable-shared \ --infodir='${prefix}'/share/info \ --mandir='${prefix}'/share/man \ --with-threads || die mmake || die } src_install() { cd ${SRCDIR} # install some missing directories minstalldir /usr || die mmake DESTDIR=${BINDIR} altinstall || die # link python${PYVER}-config to python-config mlink python${PYVER}-config /usr/bin/python-config || die minstalldir /usr/$(mlibdir)/python${PYVER}/config || die minstallfile ${SRCDIR}/Makefile.pre.in /usr/$(mlibdir)/python${PYVER}/config || die # remove hardcoded CFLAGS from default Makefile sed -i 's:^OPT=.*:OPT=-DNDEBUG:' ${BINDIR}/usr/$(mlibdir)/python${PYVER}/config/Makefile || die minstalldocs LICENSE README || die } postinstall() { # link python2.4 binary with python [ -e ${MROOT}/usr/bin/python ] && rm -f ${MROOT}/usr/bin/python ln -snf python${mPYVER} ${MROOT}/usr/bin/python # link python2.4 binary with python2 [ -e ${MROOT}/usr/bin/python2 ] && rm -f ${MROOT}/usr/bin/python2 ln -snf python${mPYVER} ${MROOT}/usr/bin/python2 }