diff options
author | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-11-28 18:39:27 +0000 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <arfrever@gentoo.org> | 2009-11-28 18:39:27 +0000 |
commit | 98dc657ab646f5e801c69c2bab17ddc1e2813c37 (patch) | |
tree | 7def851a61da13a0c037de7336ad9fb68d230b07 /eclass | |
parent | alpha/ia64/sparc stable (diff) | |
download | gentoo-2-98dc657ab646f5e801c69c2bab17ddc1e2813c37.tar.gz gentoo-2-98dc657ab646f5e801c69c2bab17ddc1e2813c37.tar.bz2 gentoo-2-98dc657ab646f5e801c69c2bab17ddc1e2813c37.zip |
Add support for distutils_src_{compile,install}_{pre,post}_hook(). Use $(PYTHON ${PYVER}) instead of ${python} in distutils_src_compile() and distutils_src_install() to support multilib systems in older EAPIs.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/distutils.eclass | 58 |
1 files changed, 44 insertions, 14 deletions
diff --git a/eclass/distutils.eclass b/eclass/distutils.eclass index b8e5b78b051a..d54c0494f346 100644 --- a/eclass/distutils.eclass +++ b/eclass/distutils.eclass @@ -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.66 2009/11/06 00:35:30 arfrever Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.67 2009/11/28 18:39:27 arfrever Exp $ # @ECLASS: distutils.eclass # @MAINTAINER: @@ -42,9 +42,18 @@ python="python" # @DESCRIPTION: # Additional DOCS +_distutils_hook() { + if [[ "$#" -ne 1 ]]; then + die "${FUNCNAME}() requires 1 argument" + fi + if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then + "distutils_src_${EBUILD_PHASE}_$1_hook" + fi +} + # @FUNCTION: distutils_src_unpack # @DESCRIPTION: -# The distutils src_unpack function, this function is exported +# 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" @@ -58,7 +67,7 @@ distutils_src_unpack() { # @FUNCTION: distutils_src_prepare # @DESCRIPTION: -# The distutils src_prepare function, this function is exported +# 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" @@ -89,7 +98,9 @@ distutils_src_prepare() { # @FUNCTION: distutils_src_compile # @DESCRIPTION: -# The distutils src_compile function, this function is exported +# The distutils src_compile function, this function is exported. +# In newer EAPIs this function calls distutils_src_compile_pre_hook() and +# distutils_src_compile_post_hook(), if they are defined. distutils_src_compile() { if [[ "${EBUILD_PHASE}" != "compile" ]]; then die "${FUNCNAME}() can be used only in src_compile() phase" @@ -98,26 +109,37 @@ distutils_src_compile() { if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then building() { + _distutils_hook pre + echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" - "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || return "$?" + + _distutils_hook post } python_execute_function -s building "$@" else building() { + _distutils_hook pre + echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" - "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" || return "$?" + + _distutils_hook post } python_execute_function building "$@" fi else - echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" - ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" + python_version + echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" + "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" fi } # @FUNCTION: distutils_src_install # @DESCRIPTION: # The distutils src_install function, this function is exported. +# In newer EAPIs this function calls distutils_src_install_pre_hook() and +# distutils_src_install_post_hook(), if they are defined. # It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, MAINTAINERS, # PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS) distutils_src_install() { @@ -133,6 +155,8 @@ distutils_src_install() { if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then installation() { + _distutils_hook pre + # 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) @@ -141,11 +165,15 @@ distutils_src_install() { [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" - "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || return "$?" + + _distutils_hook post } python_execute_function -s installation "$@" else installation() { + _distutils_hook pre + # 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) @@ -154,7 +182,9 @@ distutils_src_install() { [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" - "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" + "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" || return "$?" + + _distutils_hook post } python_execute_function installation "$@" fi @@ -163,11 +193,11 @@ distutils_src_install() { # a package uses distutils but does not install anything # in site-packages. (eg. dev-java/java-config-2.x) # - liquidx (14/08/2006) - pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" + pylibdir="$("$(PYTHON "${PYVER}")" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" - echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" - ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" + echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" + "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" fi if [[ -e "${D}usr/local" ]]; then @@ -251,7 +281,7 @@ distutils_pkg_postrm() { # @FUNCTION: distutils_python_version # @DESCRIPTION: # Calls python_version, so that you can use something like -# e.g. insinto ${ROOT}/usr/include/python${PYVER} +# e.g. insinto ${ROOT}/usr/include/python${PYVER} distutils_python_version() { python_version } |