# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id$ EAPI="5" WANT_LIBTOOL="none" inherit autotools eutils flag-o-matic multilib pax-utils python-utils-r1 toolchain-funcs MY_P="Python-${PV/_/}" PATCHSET_VERSION="3.5.0-0" DESCRIPTION="An interpreted, interactive, object-oriented programming language" HOMEPAGE="http://www.python.org/" SRC_URI="http://www.python.org/ftp/python/${PV%_rc*}/${MY_P}.tar.xz https://dev.gentoo.org/~floppym/python/python-gentoo-patches-${PATCHSET_VERSION}.tar.xz" LICENSE="PSF-2" SLOT="3.5" KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd" IUSE="build elibc_uclibc examples gdbm hardened ipv6 libressl +ncurses +readline sqlite +ssl +threads tk 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= app-arch/xz-utils:0= >=sys-libs/zlib-1.1.3:0= virtual/libffi virtual/libintl 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:= ) ) 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:0= ) !!/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 ) # 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}:}. else vars=( PYTHON "${vars[@]}" ) fi python_export "python${PYVER}" "${vars[@]}" echo "EPYTHON='${EPYTHON}'" > epython.py || die python_domodule epython.py } pkg_preinst() { if has_version "<${CATEGORY}/${PN}-${SLOT}" && ! has_version ">=${CATEGORY}/${PN}-${SLOT}_alpha"; then python_updater_warning="1" 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 if [[ "${python_updater_warning}" == "1" ]]; then ewarn "You have just upgraded from an older version of Python." ewarn ewarn "Please adjust PYTHON_TARGETS (if so desired), and run emerge with the --newuse or --changed-use option to rebuild packages installing python modules." fi } pkg_postrm() { eselect_python_update }