public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arfrever Frehtes Taifersar Arahesis (arfrever)" <arfrever@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: distutils.eclass
Date: Wed, 12 Aug 2009 02:24:34 +0000	[thread overview]
Message-ID: <E1Mb3Vy-0002r6-32@stork.gentoo.org> (raw)

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.eclass?rev=1.59&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.eclass?rev=1.59&content-type=text/plain
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/distutils.eclass?r1=1.58&r2=1.59

Index: distutils.eclass
===================================================================
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/08/05 18:34:56 arfrever Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.59 2009/08/12 02:24:34 arfrever Exp $
 
 # @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
 
-inherit python multilib eutils
+inherit eutils multilib python
 
 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}" != "unpack" ]]; then
+		die "${FUNCNAME}() can be used only in src_unpack() phase"
+	fi
+
 	unpack ${A}
 	cd "${S}"
 
@@ -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}" != "prepare" ]]; then
+		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}" != "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
 }
 
@@ -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}" != "install" ]]; then
+		die "${FUNCNAME}() can be used only in src_install() phase"
+	fi
+
 	local pylibdir
 
 	# Mark the package to be rebuilt after a python upgrade.
 	python_need_rebuild
 
 	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 --root="${D}" --no-compile "$@"
 			"$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${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="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
 		[[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
 
-		${python} setup.py install --root="${D}" --no-compile "$@" || die "python setup.py install failed"
+		echo ${python} setup.py install --root="${D}" --no-compile "$@"
+		${python} setup.py install --root="${D}" --no-compile "$@" || die "Installation failed"
 	fi
 
 	DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS"
@@ -130,6 +146,10 @@
 # @DESCRIPTION:
 # Generic pyc/pyo cleanup script. This function is exported.
 distutils_pkg_postrm() {
+	if [[ "${EBUILD_PHASE}" != "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
 
-	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
 }
 
 # @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}" != "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






             reply	other threads:[~2009-08-12  2:24 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12  2:24 Arfrever Frehtes Taifersar Arahesis (arfrever) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-12 18:49 [gentoo-commits] gentoo-x86 commit in eclass: distutils.eclass Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-12-24 15:05 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-12-13 13:36 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-10-10 19:23 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-07-17 23:03 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-05-25 15:07 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-03-04 17:49 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-28 11:52 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-02-08  9:35 Peter Volkov (pva)
2010-02-07 21:17 Peter Volkov (pva)
2010-02-04 18:31 Arfrever Frehtes Taifersar Arahesis (arfrever)
2010-01-10 17:24 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-12-24  4:21 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-28 18:39 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-11-06  0:35 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-10-11 13:38 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-11 20:03 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-11 12:24 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-09 19:26 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-07  2:34 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-09-05 16:45 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-05 18:34 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-08-02  0:30 Arfrever Frehtes Taifersar Arahesis (arfrever)
2009-02-18 14:43 Peter Volkov (pva)
2008-10-28 21:29 Ali Polatel (hawking)
2008-10-27  0:19 Ali Polatel (hawking)
2008-09-24 16:45 Ali Polatel (hawking)
2008-06-28  0:05 Luca Longinotti (chtekk)
2008-06-24 13:40 Ali Polatel (hawking)
2008-06-20 18:21 Ali Polatel (hawking)
2008-05-30 10:22 Ali Polatel (hawking)
2008-05-29 15:24 Ali Polatel (hawking)
2008-01-23 22:19 Ali Polatel (hawking)
2007-10-25 13:49 Ali Polatel (hawking)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Mb3Vy-0002r6-32@stork.gentoo.org \
    --to=arfrever@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox