# Copyright 1999-2018 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI="5" WANT_LIBTOOL="none" inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs multiprocessing MY_P="Python-${PV}" PATCHSET_VERSION="2.7.14-0" DESCRIPTION="An interpreted, interactive, object-oriented programming language" HOMEPAGE="https://www.python.org/" SRC_URI="https://www.python.org/ftp/python/${PV}/${MY_P}.tar.xz https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" LICENSE="PSF-2" SLOT="2.7" KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~x86-fbsd" IUSE="-berkdb build doc elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk +wide-unicode wininst +xml" # Do not add a dependency on dev-lang/python to this ebuild. # If you need to apply a patch which requires python for bootstrapping, please # run the bootstrap code on your dev box and include the results in the # patchset. See bug 447752. RDEPEND="app-arch/bzip2:0= >=sys-libs/zlib-1.1.3:0= virtual/libffi:= virtual/libintl berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:5.1 sys-libs/db:4.8 sys-libs/db:4.7 sys-libs/db:4.6 sys-libs/db:4.5 sys-libs/db:4.4 sys-libs/db:4.3 sys-libs/db:4.2 ) ) gdbm? ( sys-libs/gdbm:0=[berkdb] ) ncurses? ( >=sys-libs/ncurses-5.2:0= ) readline? ( >=sys-libs/readline-4.1:0= ) sqlite? ( >=dev-db/sqlite-3.3.8:3= ) ssl? ( !libressl? ( dev-libs/openssl:0= ) libressl? ( dev-libs/libressl:0= ) ) tk? ( >=dev-lang/tcl-8.0:0= >=dev-lang/tk-8.0:0= dev-tcltk/blt:0= dev-tcltk/tix ) xml? ( >=dev-libs/expat-2.1 ) !!/dev/null) newins "${S}"/Tools/gdb/libpython.py "${libname}"-gdb.py newconfd "${FILESDIR}/pydoc.conf" pydoc-${SLOT} newinitd "${FILESDIR}/pydoc.init" pydoc-${SLOT} sed \ -e "s:@PYDOC_PORT_VARIABLE@:PYDOC${SLOT/./_}_PORT:" \ -e "s:@PYDOC@:pydoc${SLOT}:" \ -i "${ED}etc/conf.d/pydoc-${SLOT}" "${ED}etc/init.d/pydoc-${SLOT}" || die "sed failed" # for python-exec local vars=( EPYTHON PYTHON_SITEDIR PYTHON_SCRIPTDIR ) # if not using a cross-compiler, use the fresh binary if ! tc-is-cross-compiler; then local -x PYTHON=./python local -x LD_LIBRARY_PATH=${LD_LIBRARY_PATH+${LD_LIBRARY_PATH}:}${PWD} else vars=( PYTHON "${vars[@]}" ) fi python_export "python${SLOT}" "${vars[@]}" echo "EPYTHON='${EPYTHON}'" > epython.py || die python_domodule epython.py # python-exec wrapping support local pymajor=${SLOT%.*} mkdir -p "${D}${PYTHON_SCRIPTDIR}" || die # python and pythonX ln -s "../../../bin/python${SLOT}" \ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}" || die ln -s "python${pymajor}" \ "${D}${PYTHON_SCRIPTDIR}/python" || die # python-config and pythonX-config ln -s "../../../bin/python${SLOT}-config" \ "${D}${PYTHON_SCRIPTDIR}/python${pymajor}-config" || die ln -s "python${pymajor}-config" \ "${D}${PYTHON_SCRIPTDIR}/python-config" || die # 2to3, pydoc, pyvenv ln -s "../../../bin/2to3-${SLOT}" \ "${D}${PYTHON_SCRIPTDIR}/2to3" || die ln -s "../../../bin/pydoc${SLOT}" \ "${D}${PYTHON_SCRIPTDIR}/pydoc" || die # idle if use tk; then ln -s "../../../bin/idle${SLOT}" \ "${D}${PYTHON_SCRIPTDIR}/idle" || die fi } eselect_python_update() { if [[ -z "$(eselect python show)" || ! -f "${EROOT}usr/bin/$(eselect python show)" ]]; then eselect python update fi if [[ -z "$(eselect python show --python${PV%%.*})" || ! -f "${EROOT}usr/bin/$(eselect python show --python${PV%%.*})" ]]; then eselect python update --python${PV%%.*} fi } pkg_postinst() { eselect_python_update } pkg_postrm() { eselect_python_update }