From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Mb3W1-0001Rj-2Z for garchives@archives.gentoo.org; Wed, 12 Aug 2009 02:24:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 76E09E03DE; Wed, 12 Aug 2009 02:24:35 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3B448E03DE for ; Wed, 12 Aug 2009 02:24:35 +0000 (UTC) Received: from stork.gentoo.org (stork.gentoo.org [64.127.104.133]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id CAD5D65ECE for ; Wed, 12 Aug 2009 02:24:34 +0000 (UTC) Received: from arfrever by stork.gentoo.org with local (Exim 4.69) (envelope-from ) id 1Mb3Vy-0002r6-32 for gentoo-commits@lists.gentoo.org; Wed, 12 Aug 2009 02:24:34 +0000 From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, arfrever@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: distutils.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: distutils.eclass X-VCS-Directories: eclass X-VCS-Committer: arfrever X-VCS-Committer-Name: Arfrever Frehtes Taifersar Arahesis Content-Type: text/plain; charset=utf8 Message-Id: Sender: Arfrever Frehtes Taifersar Arahesis Date: Wed, 12 Aug 2009 02:24:34 +0000 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: ff72968e-4809-434d-87dc-18ffac1aa302 X-Archives-Hash: f1a84d62c37341dab5bcf597d4b9e774 arfrever 09/08/12 02:24:34 Modified: distutils.eclass Log: Add checks for correct ebuild phase. Revision Changes Path 1.59 eclass/distutils.eclass file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.e= class?rev=3D1.59&view=3Dmarkup plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.e= class?rev=3D1.59&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.e= class?r1=3D1.58&r2=3D1.59 Index: distutils.eclass =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v retrieving revision 1.58 retrieving revision 1.59 diff -u -r1.58 -r1.59 --- distutils.eclass 5 Aug 2009 18:34:56 -0000 1.58 +++ distutils.eclass 12 Aug 2009 02:24:34 -0000 1.59 @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.58 2009/0= 8/05 18:34:56 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.59 2009/0= 8/12 02:24:34 arfrever Exp $ =20 # @ECLASS: distutils.eclass # @MAINTAINER: @@ -12,10 +12,8 @@ # The distutils eclass is designed to allow easier installation of # distutils-based python modules and their incorporation into # the Gentoo Linux system. -# -# It inherits python, multilib, and eutils =20 -inherit python multilib eutils +inherit eutils multilib python =20 case "${EAPI:-0}" in 0|1) @@ -49,6 +47,10 @@ # @DESCRIPTION: # The distutils src_unpack function, this function is exported distutils_src_unpack() { + if [[ "${EBUILD_PHASE}" !=3D "unpack" ]]; then + die "${FUNCNAME}() can be used only in src_unpack() phase" + fi + unpack ${A} cd "${S}" =20 @@ -59,6 +61,10 @@ # @DESCRIPTION: # The distutils src_prepare function, this function is exported distutils_src_prepare() { + if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" !=3D "prepare" ]]; th= en + die "${FUNCNAME}() can be used only in src_prepare() phase" + fi + # remove ez_setup stuff to prevent packages # from installing setuptools on their own rm -rf ez_setup* @@ -69,14 +75,19 @@ # @DESCRIPTION: # The distutils src_compile function, this function is exported distutils_src_compile() { + if [[ "${EBUILD_PHASE}" !=3D "compile" ]]; then + die "${FUNCNAME}() can be used only in src_compile() phase" + fi + if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then - build_modules() { + building() { echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" } - python_execute_function build_modules "$@" + python_execute_function building "$@" else - ${python} setup.py build "$@" || die "compilation failed" + echo ${python} setup.py build "$@" + ${python} setup.py build "$@" || die "Building failed" fi } =20 @@ -86,13 +97,17 @@ # It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, = MAINTAINERS, # PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS) distutils_src_install() { + if [[ "${EBUILD_PHASE}" !=3D "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + local pylibdir =20 # Mark the package to be rebuilt after a python upgrade. python_need_rebuild =20 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then - install_modules() { + installation() { # need this for python-2.5 + setuptools in cases where # a package uses distutils but does not install anything # in site-packages. (eg. dev-java/java-config-2.x) @@ -103,7 +118,7 @@ echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --ro= ot=3D"${D}" --no-compile "$@" "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root=3D= "${D}" --no-compile "$@" } - python_execute_function install_modules "$@" + python_execute_function installation "$@" else # need this for python-2.5 + setuptools in cases where # a package uses distutils but does not install anything @@ -112,7 +127,8 @@ pylibdir=3D"$(${python} -c 'from distutils.sysconfig import get_python= _lib; print(get_python_lib())')" [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" =20 - ${python} setup.py install --root=3D"${D}" --no-compile "$@" || die "p= ython setup.py install failed" + echo ${python} setup.py install --root=3D"${D}" --no-compile "$@" + ${python} setup.py install --root=3D"${D}" --no-compile "$@" || die "I= nstallation failed" fi =20 DDOCS=3D"CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NE= WS" @@ -130,6 +146,10 @@ # @DESCRIPTION: # Generic pyc/pyo cleanup script. This function is exported. distutils_pkg_postrm() { + if [[ "${EBUILD_PHASE}" !=3D "postrm" ]]; then + die "${FUNCNAME}() can be used only in pkg_postrm() phase" + fi + local pylibdir pymod if [[ -z "${PYTHON_MODNAME}" ]]; then for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do @@ -139,7 +159,6 @@ done fi =20 - ebegin "Performing cleanup of Python modules..." if [[ -n "${PYTHON_MODNAME}" ]]; then for pymod in ${PYTHON_MODNAME}; do for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do @@ -155,7 +174,6 @@ else python_mod_cleanup fi - eend 0 } =20 # @FUNCTION: distutils_pkg_postinst @@ -163,6 +181,10 @@ # This is a generic optimization, you should override it if your package # installs modules in another directory. This function is exported. distutils_pkg_postinst() { + if [[ "${EBUILD_PHASE}" !=3D "postinst" ]]; then + die "${FUNCNAME}() can be used only in pkg_postinst() phase" + fi + local pylibdir pymod if [[ -z "${PYTHON_MODNAME}" ]]; then for pylibdir in "${ROOT}"/usr/$(get_libdir)/python*; do