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 1Q6RhB-00027G-F5 for garchives@archives.gentoo.org; Sun, 03 Apr 2011 18:06:44 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 718551C085; Sun, 3 Apr 2011 18:06:22 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id F2A281C079 for ; Sun, 3 Apr 2011 18:05:34 +0000 (UTC) Received: from afta-gentoo.localnet (ip-85-198-244-135.broker.com.pl [85.198.244.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: arfrever) by smtp.gentoo.org (Postfix) with ESMTPSA id 1764C1B4023; Sun, 3 Apr 2011 18:05:34 +0000 (UTC) From: Arfrever Frehtes Taifersar Arahesis To: Gentoo Development Subject: [gentoo-dev] Patch for distutils.eclass [2011-04-03] Date: Sun, 3 Apr 2011 20:04:55 +0200 User-Agent: KMail/1.13.6 (Linux/2.6.34-tuxonice-r8-AFTA; KDE/4.4.5; x86_64; ; ) Cc: qa@gentoo.org Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2366046.tjWInSHyVM"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201104032004.56371.Arfrever@gentoo.org> X-Archives-Salt: X-Archives-Hash: 3b16f97ad485fe1d1c2f766b4237da6b --nextPart2366046.tjWInSHyVM Content-Type: multipart/mixed; boundary="Boundary-01=_IbLmNhKGx/QDVxA" Content-Transfer-Encoding: 7bit --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline This patch for distutils.eclass is divided into 13 subpatches. Subpatch #1 bans DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable (t= oo late). Subpatch #2 removes 2 functions banned long time ago. Subpatch #3 adds handling of *-nspkg.pth files in distutils_src_install(). Subpatch #4 adds missing sanity checks for execution of python_pkg_setup() = in EAPI >=3D4. Subpatch #5 adds support for EAPI=3D"4" in handling of DOCS variable. Subpatch #6 disables installation of useless files. Subpatch #7 adds sanity checks for appropriateness of execution of distutil= s_pkg_postinst() and distutils_pkg_postrm(). Subpatch #8 adds support for EAPI=3D"4" in handling of DISTUTILS_GLOBAL_OPT= IONS array. Subpatch #9 adds distutils_get_intermediate_installation_image() function, = which will be used in a small number of ebuilds, which currently rely on knowledge of imp= lementation details of distutils.eclass. Subpatch #10 adds support for automatic changing of current working directo= ry in handling of DISTUTILS_SETUP_FILES (in all EAPIs). Example: # Change current working directory to bindings/python and execute setup.py DISTUTILS_SETUP_FILES=3D("bindings/python|setup.py") Subpatch #11 adds sanity checks for arguments in some functions. Subpatch #12 adds unsetting of some internal functions after using of them. Subpatch #13 moves declaration of local variables to other places for consi= stency with python.eclass. I'm planning to commit this patch in 1 week. =2D-=20 Arfrever Frehtes Taifersar Arahesis --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch" =2D-- distutils.eclass +++ distutils.eclass @@ -1,4 +1,4 @@ =2D# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.79 2010/12/= 24 15:05:24 arfrever Exp $ =20 @@ -58,11 +58,17 @@ =20 # @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES # @DESCRIPTION: =2D# Paths to setup files. +# Array of paths to setup files. +# Syntax: +# [current_working_directory|]path_to_setup_file =20 # @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS # @DESCRIPTION: =2D# Global options passed to setup files. +# Array of global options passed to setup files. +# Syntax in EAPI <4: +# global_option +# Syntax in EAPI >=3D4: +# Python_ABI_pattern global_option =20 # @ECLASS-VARIABLE: DISTUTILS_SRC_TEST # @DESCRIPTION: @@ -100,19 +106,10 @@ EXPORT_FUNCTIONS src_test fi =20 =2D# @ECLASS-VARIABLE: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS =2D# @DESCRIPTION: =2D# Set this to disable renaming of Python scripts containing versioned sh= ebangs =2D# and generation of wrapper scripts. +# Scheduled for deletion on 2011-06-01. if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then =2D ewarn =2D ewarn "\"${EBUILD}\":" =2D ewarn "Deprecation Warning: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRI= PTS is deprecated" =2D ewarn "and will be banned on 2011-02-01. Use PYTHON_NONVERSIONED_EXECUT= ABLES=3D(\".*\")." =2D ewarn "The ebuild needs to be fixed. Please report a bug, if it has not= been already reported." =2D ewarn =2D =2D PYTHON_NONVERSIONED_EXECUTABLES=3D(".*") + eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=3D(\".*\") instead of DISTUTI= LS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable." + die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned" fi =20 # @ECLASS-VARIABLE: DOCS @@ -144,6 +141,48 @@ fi } =20 +_distutils_prepare_global_options() { + local element option pattern + + if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(decl= are -p DISTUTILS_GLOBAL_OPTIONS)" !=3D "declare -a DISTUTILS_GLOBAL_OPTIONS= =3D"* ]]; then + die "DISTUTILS_GLOBAL_OPTIONS should be indexed array" + fi + + if has "${EAPI:-0}" 0 1 2 3; then + _DISTUTILS_GLOBAL_OPTIONS=3D("${DISTUTILS_GLOBAL_OPTIONS[@]}") + else + _DISTUTILS_GLOBAL_OPTIONS=3D() + + for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do + if [[ ! "${element}" =3D~ ^[^[:space:]]+\ . ]]; then + die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invali= d syntax" + fi + pattern=3D"${element%% *}" + option=3D"${element#* }" + if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then + _DISTUTILS_GLOBAL_OPTIONS+=3D("${option}") + fi + done + fi +} + +_distutils_prepare_current_working_directory() { + if [[ "$1" =3D=3D *"|"*"|"* ]]; then + die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax" + fi + + if [[ "$1" =3D=3D *"|"* ]]; then + echo "${_BOLD}[${1%|*}]${_NORMAL}" + pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed" + fi +} + +_distutils_restore_current_working_directory() { + if [[ "$1" =3D=3D *"|"* ]]; then + popd > /dev/null || die "Leaving directory '${1%|*}' failed" + fi +} + # @FUNCTION: distutils_src_unpack # @DESCRIPTION: # The distutils src_unpack function. This function is exported. @@ -170,8 +209,15 @@ die "${FUNCNAME}() can be used only in src_prepare() phase" fi =20 + _python_check_python_pkg_setup_execution + + local distribute_setup_existence=3D"0" ez_setup_existence=3D"0" + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + # Delete ez_setup files to prevent packages from installing Setuptools on= their own. =2D local ez_setup_existence=3D"0" [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence=3D"1" rm -fr ez_setup* if [[ "${ez_setup_existence}" =3D=3D "1" ]]; then @@ -179,7 +225,6 @@ fi =20 # Delete distribute_setup files to prevent packages from installing Distr= ibute on their own. =2D local distribute_setup_existence=3D"0" [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_e= xistence=3D"1" rm -fr distribute_setup* if [[ "${distribute_setup_existence}" =3D=3D "1" ]]; then @@ -201,26 +246,40 @@ die "${FUNCNAME}() can be used only in src_compile() phase" fi =20 + _python_check_python_pkg_setup_execution _python_set_color_variables =20 + local setup_file + if _python_package_supporting_installation_for_multiple_python_abis; then distutils_building() { _distutils_hook pre =20 =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS= [@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -= b "$(_distutils_get_build_dir)" "$@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIO= NS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build= -b "$(_distutils_get_build_dir)" "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s}= distutils_building "$@" + unset -f distutils_building else =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[= @]}" build "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$= @" || die "Building failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" build "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build = "$@" || die "Building failed" + + _distutils_restore_current_working_directory "${setup_file}" done fi } @@ -257,27 +316,41 @@ die "${FUNCNAME}() can be used only in src_test() phase" fi =20 + _python_check_python_pkg_setup_execution _python_set_color_variables =20 + local arguments setup_file + if [[ "${DISTUTILS_SRC_TEST}" =3D=3D "setup.py" ]]; then if _python_package_supporting_installation_for_multiple_python_abis; then distutils_testing() { _distutils_hook pre =20 =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)= " "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_= dir)") test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fi= le}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOU= RCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "= $@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" = "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_U= SE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_buil= d_dir)") test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file= #*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_S= OURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test= "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s= } distutils_testing "$@" + unset -f distutils_testing else =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)"= "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fil= e}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "= ${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#= *|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" + + _distutils_restore_current_working_directory "${setup_file}" done fi elif [[ "${DISTUTILS_SRC_TEST}" =3D=3D "nosetests" ]]; then @@ -290,16 +363,15 @@ python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@" # trial requires an argument, which is usually equal to "${PN}". elif [[ "${DISTUTILS_SRC_TEST}" =3D~ ^trial(\ .*)?$ ]]; then =2D local trial_arguments if [[ "${DISTUTILS_SRC_TEST}" =3D=3D "trial "* ]]; then =2D trial_arguments=3D"${DISTUTILS_SRC_TEST#trial }" + arguments=3D"${DISTUTILS_SRC_TEST#trial }" else =2D trial_arguments=3D"${PN}" + arguments=3D"${PN}" fi =20 _distutils_src_test_hook trial =20 =2D python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@" + python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_S= EPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@" else die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SR= C_TEST}'" fi @@ -311,56 +383,95 @@ # In ebuilds of packages supporting installation for multiple versions of = Python, this function # calls distutils_src_install_pre_hook() and distutils_src_install_post_ho= ok(), if they are defined. # It also installs some standard documentation files (AUTHORS, Change*, CH= ANGELOG, CONTRIBUTORS, =2D# KNOWN_BUGS, MAINTAINERS, MANIFEST*, NEWS, PKG-INFO, README*, TODO). +# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO). distutils_src_install() { if [[ "${EBUILD_PHASE}" !=3D "install" ]]; then die "${FUNCNAME}() can be used only in src_install() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables _python_set_color_variables =20 + local default_docs doc line nspkg_pth_file nspkg_pth_files=3D() setup_file + if _python_package_supporting_installation_for_multiple_python_abis; then distutils_installation() { _distutils_hook pre =20 =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS= [@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo bui= ld -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/im= ages/${PYTHON_ABI}" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z= "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_dis= tutils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PYTHON= _ABI}" "$@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIO= NS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo b= uild -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/= images/${PYTHON_ABI}" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ = =2Dz "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(= _distutils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PY= THON_ABI}" "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s}= distutils_installation "$@" + unset -f distutils_installation =20 python_merge_intermediate_installation_images "${T}/images" else # Mark the package to be rebuilt after a Python upgrade. python_need_rebuild =20 =2D local setup_file + _distutils_prepare_global_options + for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[= @]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install = =2D-root=3D"${D}" --no-compile "$@" || die "Installation failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" instal= l --root=3D"${D}" --no-compile "$@" || die "Installation failed" + + _distutils_restore_current_working_directory "${setup_file}" + done + fi + + while read -d $'\0' -r nspkg_pth_file; do + nspkg_pth_files+=3D("${nspkg_pth_file}") + done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0) + + if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then + einfo + einfo "Python namespaces:" + for nspkg_pth_file in "${nspkg_pth_files[@]}"; do + einfo " '${nspkg_pth_file#${ED%/}}':" + while read -r line; do + einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^'= ]\+\)').*/\1/")" + done < "${nspkg_pth_file}" + if ! has "${EAPI:-0}" 0 1 2 3; then + rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' fail= ed" + fi done + einfo fi =20 if [[ -e "${ED}usr/local" ]]; then die "Illegal installation into /usr/local" fi =20 =2D local default_docs =2D default_docs=3D"AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINT= AINERS MANIFEST* NEWS PKG-INFO README* TODO" + default_docs=3D"AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAI= NERS NEWS README* TODO" =20 =2D local doc for doc in ${default_docs}; do [[ -s "${doc}" ]] && dodoc "${doc}" done =20 =2D if [[ -n "${DOCS}" ]]; then =2D dodoc ${DOCS} || die "dodoc failed" + if has "${EAPI:-0}" 0 1 2 3; then + if [[ -n "${DOCS}" ]]; then + dodoc ${DOCS} || die "dodoc failed" + fi + else + if [[ -n "${DOCS}" ]]; then + dodoc -r ${DOCS} || die "dodoc failed" + fi fi + + DISTUTILS_SRC_INSTALL_EXECUTED=3D"1" } =20 # @FUNCTION: distutils_pkg_postinst @@ -374,9 +485,19 @@ die "${FUNCNAME}() can be used only in pkg_postinst() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 + if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then + die "${FUNCNAME}() called illegally" + fi + local pylibdir pymod + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then @@ -407,9 +528,19 @@ die "${FUNCNAME}() can be used only in pkg_postrm() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 + if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then + die "${FUNCNAME}() called illegally" + fi + local pylibdir pymod + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then @@ -433,14 +564,29 @@ fi } =20 =2D# Scheduled for deletion on 2011-01-01. =2Ddistutils_python_version() { =2D eerror "Use PYTHON() instead of python variable. Use python_get_*() ins= tead of PYVER* variables." =2D die "${FUNCNAME}() is banned" =2D} +# @FUNCTION: distutils_get_intermediate_installation_image +# @DESCRIPTION: +# Print path to intermediate installation image. +# +# This function can be used only in distutils_src_install_pre_hook() and d= istutils_src_install_post_hook(). +distutils_get_intermediate_installation_image() { + if [[ "${EBUILD_PHASE}" !=3D "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; th= en + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting = installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + if [[ ! "${FUNCNAME[1]}" =3D~ ^distutils_src_install_(pre|post)_hook$ ]];= then + die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() = and distutils_src_install_post_hook()" + fi + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi =20 =2D# Scheduled for deletion on 2011-01-01. =2Ddistutils_python_tkinter() { =2D eerror "Use PYTHON_USE_WITH=3D\"xml\" and python_pkg_setup() instead of= ${FUNCNAME}()." =2D die "${FUNCNAME}() is banned" + echo "${T}/images/${PYTHON_ABI}" } --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.1" =2D-- distutils.eclass +++ distutils.eclass @@ -1,4 +1,4 @@ =2D# Copyright 1999-2010 Gentoo Foundation +# Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.79 2010/12/= 24 15:05:24 arfrever Exp $ =20 @@ -100,19 +100,10 @@ EXPORT_FUNCTIONS src_test fi =20 =2D# @ECLASS-VARIABLE: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS =2D# @DESCRIPTION: =2D# Set this to disable renaming of Python scripts containing versioned sh= ebangs =2D# and generation of wrapper scripts. +# Scheduled for deletion on 2011-06-01. if [[ -n "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" ]]; then =2D ewarn =2D ewarn "\"${EBUILD}\":" =2D ewarn "Deprecation Warning: DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRI= PTS is deprecated" =2D ewarn "and will be banned on 2011-02-01. Use PYTHON_NONVERSIONED_EXECUT= ABLES=3D(\".*\")." =2D ewarn "The ebuild needs to be fixed. Please report a bug, if it has not= been already reported." =2D ewarn =2D =2D PYTHON_NONVERSIONED_EXECUTABLES=3D(".*") + eerror "Use PYTHON_NONVERSIONED_EXECUTABLES=3D(\".*\") instead of DISTUTI= LS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable." + die "DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS variable is banned" fi =20 # @ECLASS-VARIABLE: DOCS --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.2" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="distutils.eclass.patch.2" --- distutils.eclass +++ distutils.eclass @@ -423,15 +423,3 @@ fi fi } - -# Scheduled for deletion on 2011-01-01. -distutils_python_version() { - eerror "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables." - die "${FUNCNAME}() is banned" -} - -# Scheduled for deletion on 2011-01-01. -distutils_python_tkinter() { - eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." - die "${FUNCNAME}() is banned" -} --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.3" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.3" =2D-- distutils.eclass +++ distutils.eclass @@ -311,6 +311,8 @@ _python_initialize_prefix_variables _python_set_color_variables =20 + local line nspkg_pth_file nspkg_pth_files=3D() + if _python_package_supporting_installation_for_multiple_python_abis; then distutils_installation() { _distutils_hook pre @@ -337,6 +339,25 @@ done fi =20 + while read -d $'\0' -r nspkg_pth_file; do + nspkg_pth_files+=3D("${nspkg_pth_file}") + done < <(find "${ED}" -name "*-nspkg.pth" -type f -print0) + + if [[ "${#nspkg_pth_files[@]}" -gt 0 ]]; then + einfo + einfo "Python namespaces:" + for nspkg_pth_file in "${nspkg_pth_files[@]}"; do + einfo " '${nspkg_pth_file#${ED%/}}':" + while read -r line; do + einfo " $(echo "${line}" | sed -e "s/.*types\.ModuleType('\([^'= ]\+\)').*/\1/")" + done < "${nspkg_pth_file}" + if ! has "${EAPI:-0}" 0 1 2 3; then + rm -f "${nspkg_pth_file}" || die "Deletion of '${nspkg_pth_file}' fail= ed" + fi + done + einfo + fi + if [[ -e "${ED}usr/local" ]]; then die "Illegal installation into /usr/local" fi --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.4" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.4" =2D-- distutils.eclass +++ distutils.eclass @@ -161,6 +161,8 @@ die "${FUNCNAME}() can be used only in src_prepare() phase" fi =20 + _python_check_python_pkg_setup_execution + # Delete ez_setup files to prevent packages from installing Setuptools on= their own. local ez_setup_existence=3D"0" [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence=3D"1" @@ -192,6 +194,7 @@ die "${FUNCNAME}() can be used only in src_compile() phase" fi =20 + _python_check_python_pkg_setup_execution _python_set_color_variables =20 if _python_package_supporting_installation_for_multiple_python_abis; then @@ -248,6 +251,7 @@ die "${FUNCNAME}() can be used only in src_test() phase" fi =20 + _python_check_python_pkg_setup_execution _python_set_color_variables =20 if [[ "${DISTUTILS_SRC_TEST}" =3D=3D "setup.py" ]]; then @@ -308,6 +312,7 @@ die "${FUNCNAME}() can be used only in src_install() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables _python_set_color_variables =20 @@ -386,6 +391,7 @@ die "${FUNCNAME}() can be used only in pkg_postinst() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 local pylibdir pymod @@ -419,6 +425,7 @@ die "${FUNCNAME}() can be used only in pkg_postrm() phase" fi =20 + _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 local pylibdir pymod --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.5" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.5" =2D-- distutils.eclass +++ distutils.eclass @@ -375,8 +375,14 @@ [[ -s "${doc}" ]] && dodoc "${doc}" done =20 =2D if [[ -n "${DOCS}" ]]; then =2D dodoc ${DOCS} || die "dodoc failed" + if has "${EAPI:-0}" 0 1 2 3; then + if [[ -n "${DOCS}" ]]; then + dodoc ${DOCS} || die "dodoc failed" + fi + else + if [[ -n "${DOCS}" ]]; then + dodoc -r ${DOCS} || die "dodoc failed" + fi fi } =20 --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.6" =2D-- distutils.eclass +++ distutils.eclass @@ -306,7 +306,7 @@ # In ebuilds of packages supporting installation for multiple versions of = Python, this function # calls distutils_src_install_pre_hook() and distutils_src_install_post_ho= ok(), if they are defined. # It also installs some standard documentation files (AUTHORS, Change*, CH= ANGELOG, CONTRIBUTORS, =2D# KNOWN_BUGS, MAINTAINERS, MANIFEST*, NEWS, PKG-INFO, README*, TODO). +# KNOWN_BUGS, MAINTAINERS, NEWS, README*, TODO). distutils_src_install() { if [[ "${EBUILD_PHASE}" !=3D "install" ]]; then die "${FUNCNAME}() can be used only in src_install() phase" @@ -368,7 +368,7 @@ fi =20 local default_docs =2D default_docs=3D"AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINT= AINERS MANIFEST* NEWS PKG-INFO README* TODO" + default_docs=3D"AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAI= NERS NEWS README* TODO" =20 local doc for doc in ${default_docs}; do --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.7" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.7" =2D-- distutils.eclass +++ distutils.eclass @@ -384,6 +384,8 @@ dodoc -r ${DOCS} || die "dodoc failed" fi fi + + DISTUTILS_SRC_INSTALL_EXECUTED=3D"1" } =20 # @FUNCTION: distutils_pkg_postinst @@ -400,6 +402,10 @@ _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 + if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then + die "${FUNCNAME}() called illegally" + fi + local pylibdir pymod if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do @@ -434,6 +440,10 @@ _python_check_python_pkg_setup_execution _python_initialize_prefix_variables =20 + if [[ -z "${DISTUTILS_SRC_INSTALL_EXECUTED}" ]]; then + die "${FUNCNAME}() called illegally" + fi + local pylibdir pymod if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.8" =2D-- distutils.eclass +++ distutils.eclass @@ -135,6 +135,31 @@ fi } =20 +_distutils_prepare_global_options() { + local element option pattern + + if [[ -n "$(declare -p DISTUTILS_GLOBAL_OPTIONS 2> /dev/null)" && "$(decl= are -p DISTUTILS_GLOBAL_OPTIONS)" !=3D "declare -a DISTUTILS_GLOBAL_OPTIONS= =3D"* ]]; then + die "DISTUTILS_GLOBAL_OPTIONS should be indexed array" + fi + + if has "${EAPI:-0}" 0 1 2 3; then + _DISTUTILS_GLOBAL_OPTIONS=3D("${DISTUTILS_GLOBAL_OPTIONS[@]}") + else + _DISTUTILS_GLOBAL_OPTIONS=3D() + + for element in "${DISTUTILS_GLOBAL_OPTIONS[@]}"; do + if [[ ! "${element}" =3D~ ^[^[:space:]]+\ . ]]; then + die "Element '${element}' of DISTUTILS_GLOBAL_OPTIONS array has invali= d syntax" + fi + pattern=3D"${element%% *}" + option=3D"${element#* }" + if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then + _DISTUTILS_GLOBAL_OPTIONS+=3D("${option}") + fi + done + fi +} + # @FUNCTION: distutils_src_unpack # @DESCRIPTION: # The distutils src_unpack function. This function is exported. @@ -201,20 +226,24 @@ distutils_building() { _distutils_hook pre =20 + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS= [@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -= b "$(_distutils_get_build_dir)" "$@" || return "$?" + echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[= @]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build -b= "$(_distutils_get_build_dir)" "$@" || return "$?" done =20 _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s}= distutils_building "$@" else + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[= @]}" build "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$= @" || die "Building failed" + echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@= ]}" build "$@"${_NORMAL} + "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@= " || die "Building failed" done fi } @@ -259,20 +288,24 @@ distutils_testing() { _distutils_hook pre =20 + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)= " "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_= dir)") test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fi= le}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOU= RCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "= $@" || return "$?" + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" = "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_= SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_d= ir)") test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file= }" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOUR= CE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test "$= @" || return "$?" done =20 _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s= } distutils_testing "$@" else + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)"= "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fil= e}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "= ${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file}= " "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" done fi elif [[ "${DISTUTILS_SRC_TEST}" =3D=3D "nosetests" ]]; then @@ -322,10 +355,12 @@ distutils_installation() { _distutils_hook pre =20 + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS= [@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo bui= ld -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/im= ages/${PYTHON_ABI}" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z= "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_dis= tutils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PYTHON= _ABI}" "$@" || return "$?" + echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[= @]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo buil= d -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/ima= ges/${PYTHON_ABI}" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z = "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_dist= utils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PYTHON_= ABI}" "$@" || return "$?" done =20 _distutils_hook post @@ -337,10 +372,12 @@ # Mark the package to be rebuilt after a Python upgrade. python_need_rebuild =20 + _distutils_prepare_global_options + local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[= @]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${DISTUTILS_GLOBAL_OPTIONS[@]}" install = =2D-root=3D"${D}" --no-compile "$@" || die "Installation failed" + echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@= ]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} + "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install -= =2Droot=3D"${D}" --no-compile "$@" || die "Installation failed" done fi =20 --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.9" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="distutils.eclass.patch.9" --- distutils.eclass +++ distutils.eclass @@ -504,3 +504,26 @@ fi fi } + +# @FUNCTION: distutils_get_intermediate_installation_image +# @DESCRIPTION: +# Print path to intermediate installation image. +# +# This function can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook(). +distutils_get_intermediate_installation_image() { + if [[ "${EBUILD_PHASE}" != "install" ]]; then + die "${FUNCNAME}() can be used only in src_install() phase" + fi + + if ! _python_package_supporting_installation_for_multiple_python_abis; then + die "${FUNCNAME}() cannot be used in ebuilds of packages not supporting installation for multiple Python ABIs" + fi + + _python_check_python_pkg_setup_execution + + if [[ ! "${FUNCNAME[1]}" =~ ^distutils_src_install_(pre|post)_hook$ ]]; then + die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() and distutils_src_install_post_hook()" + fi + + echo "${T}/images/${PYTHON_ABI}" +} --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.10" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.10" =2D-- distutils.eclass +++ distutils.eclass @@ -58,11 +58,17 @@ =20 # @ECLASS-VARIABLE: DISTUTILS_SETUP_FILES # @DESCRIPTION: =2D# Paths to setup files. +# Array of paths to setup files. +# Syntax: +# [current_working_directory|]path_to_setup_file =20 # @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS # @DESCRIPTION: =2D# Global options passed to setup files. +# Array of global options passed to setup files. +# Syntax in EAPI <4: +# global_option +# Syntax in EAPI >=3D4: +# Python_ABI_pattern global_option =20 # @ECLASS-VARIABLE: DISTUTILS_SRC_TEST # @DESCRIPTION: @@ -160,6 +166,23 @@ fi } =20 +_distutils_prepare_current_working_directory() { + if [[ "$1" =3D=3D *"|"*"|"* ]]; then + die "Element '$1' of DISTUTILS_SETUP_FILES array has invalid syntax" + fi + + if [[ "$1" =3D=3D *"|"* ]]; then + echo "${_BOLD}[${1%|*}]${_NORMAL}" + pushd "${1%|*}" > /dev/null || die "Entering directory '${1%|*}' failed" + fi +} + +_distutils_restore_current_working_directory() { + if [[ "$1" =3D=3D *"|"* ]]; then + popd > /dev/null || die "Leaving directory '${1%|*}' failed" + fi +} + # @FUNCTION: distutils_src_unpack # @DESCRIPTION: # The distutils src_unpack function. This function is exported. @@ -230,8 +253,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build = =2Db "$(_distutils_get_build_dir)" "$@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIO= NS[@]}" build -b "$(_distutils_get_build_dir)" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build= -b "$(_distutils_get_build_dir)" "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post @@ -242,8 +269,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS= [@]}" build "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build "= $@" || die "Building failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" build "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" build = "$@" || die "Building failed" + + _distutils_restore_current_working_directory "${setup_file}" done fi } @@ -292,8 +323,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)= " "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_US= E_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build= _dir)") test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fi= le}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SO= URCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test = "$@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" = "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_U= SE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_buil= d_dir)") test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file= #*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_S= OURCE_DIRECTORIES}" ]] && echo build -b "$(_distutils_get_build_dir)") test= "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post @@ -304,8 +339,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)"= "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} =2D PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_fil= e}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "= ${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@"${_NORMAL} + PYTHONPATH=3D"$(_distutils_get_PYTHONPATH)" "$(PYTHON)" "${setup_file#= *|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" test "$@" || die "Testing failed" + + _distutils_restore_current_working_directory "${setup_file}" done fi elif [[ "${DISTUTILS_SRC_TEST}" =3D=3D "nosetests" ]]; then @@ -359,8 +398,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo bu= ild -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/i= mages/${PYTHON_ABI}" "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ -= z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(_di= stutils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PYTHO= N_ABI}" "$@" || return "$?" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIO= NS[@]}" $([[ -z "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo b= uild -b "$(_distutils_get_build_dir)") install --no-compile --root=3D"${T}/= images/${PYTHON_ABI}" "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" $([[ = =2Dz "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]] && echo build -b "$(= _distutils_get_build_dir)") install --no-compile --root=3D"${T}/images/${PY= THON_ABI}" "$@" || return "$?" + + _distutils_restore_current_working_directory "${setup_file}" done =20 _distutils_hook post @@ -376,8 +419,12 @@ =20 local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do =2D echo ${_BOLD}"$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS= [@]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} =2D "$(PYTHON)" "${setup_file}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" install= --root=3D"${D}" --no-compile "$@" || die "Installation failed" + _distutils_prepare_current_working_directory "${setup_file}" + + echo ${_BOLD}"$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTION= S[@]}" install --root=3D"${D}" --no-compile "$@"${_NORMAL} + "$(PYTHON)" "${setup_file#*|}" "${_DISTUTILS_GLOBAL_OPTIONS[@]}" instal= l --root=3D"${D}" --no-compile "$@" || die "Installation failed" + + _distutils_restore_current_working_directory "${setup_file}" done fi =20 --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.11" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.11" =2D-- distutils.eclass +++ distutils.eclass @@ -211,6 +211,10 @@ =20 _python_check_python_pkg_setup_execution =20 + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + # Delete ez_setup files to prevent packages from installing Setuptools on= their own. local ez_setup_existence=3D"0" [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence=3D"1" @@ -491,6 +495,11 @@ fi =20 local pylibdir pymod + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then @@ -529,6 +538,11 @@ fi =20 local pylibdir pymod + + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + if [[ -z "$(declare -p PYTHON_MODNAME 2> /dev/null)" ]]; then for pylibdir in "${EROOT}"usr/$(get_libdir)/python* "${EROOT}"usr/share/= jython-*/Lib; do if [[ -d "${pylibdir}/site-packages/${PN}" ]]; then @@ -572,5 +586,9 @@ die "${FUNCNAME}() can be used only in distutils_src_install_pre_hook() = and distutils_src_install_post_hook()" fi =20 + if [[ "$#" -ne 0 ]]; then + die "${FUNCNAME}() does not accept arguments" + fi + echo "${T}/images/${PYTHON_ABI}" } --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.12" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.12" =2D-- distutils.eclass +++ distutils.eclass @@ -268,6 +268,7 @@ _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s}= distutils_building "$@" + unset -f distutils_building else _distutils_prepare_global_options =20 @@ -338,6 +339,7 @@ _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s= } distutils_testing "$@" + unset -f distutils_testing else _distutils_prepare_global_options =20 @@ -413,6 +415,7 @@ _distutils_hook post } python_execute_function ${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES:+-s}= distutils_installation "$@" + unset -f distutils_installation =20 python_merge_intermediate_installation_images "${T}/images" else --Boundary-01=_IbLmNhKGx/QDVxA Content-Type: text/x-patch; charset="utf-8"; name="distutils.eclass.patch.13" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline; filename="distutils.eclass.patch.13" =2D-- distutils.eclass.12 2011-04-03 01:52:18.815859897 +0200 +++ distutils.eclass.13 2011-04-03 02:04:03.093858500 +0200 @@ -211,12 +211,13 @@ =20 _python_check_python_pkg_setup_execution =20 + local distribute_setup_existence=3D"0" ez_setup_existence=3D"0" + if [[ "$#" -ne 0 ]]; then die "${FUNCNAME}() does not accept arguments" fi =20 # Delete ez_setup files to prevent packages from installing Setuptools on= their own. =2D local ez_setup_existence=3D"0" [[ -d ez_setup || -f ez_setup.py ]] && ez_setup_existence=3D"1" rm -fr ez_setup* if [[ "${ez_setup_existence}" =3D=3D "1" ]]; then @@ -224,7 +225,6 @@ fi =20 # Delete distribute_setup files to prevent packages from installing Distr= ibute on their own. =2D local distribute_setup_existence=3D"0" [[ -d distribute_setup || -f distribute_setup.py ]] && distribute_setup_e= xistence=3D"1" rm -fr distribute_setup* if [[ "${distribute_setup_existence}" =3D=3D "1" ]]; then @@ -249,13 +249,14 @@ _python_check_python_pkg_setup_execution _python_set_color_variables =20 + local setup_file + if _python_package_supporting_installation_for_multiple_python_abis; then distutils_building() { _distutils_hook pre =20 _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -272,7 +273,6 @@ else _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -319,6 +319,8 @@ _python_check_python_pkg_setup_execution _python_set_color_variables =20 + local arguments setup_file + if [[ "${DISTUTILS_SRC_TEST}" =3D=3D "setup.py" ]]; then if _python_package_supporting_installation_for_multiple_python_abis; then distutils_testing() { @@ -326,7 +328,6 @@ =20 _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -343,7 +344,6 @@ else _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -363,16 +363,15 @@ python_execute_py.test -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES:+-s} -- "$@" # trial requires an argument, which is usually equal to "${PN}". elif [[ "${DISTUTILS_SRC_TEST}" =3D~ ^trial(\ .*)?$ ]]; then =2D local trial_arguments if [[ "${DISTUTILS_SRC_TEST}" =3D=3D "trial "* ]]; then =2D trial_arguments=3D"${DISTUTILS_SRC_TEST#trial }" + arguments=3D"${DISTUTILS_SRC_TEST#trial }" else =2D trial_arguments=3D"${PN}" + arguments=3D"${PN}" fi =20 _distutils_src_test_hook trial =20 =2D python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE= _SEPARATE_SOURCE_DIRECTORIES:+-s} -- ${trial_arguments} "$@" + python_execute_trial -P '$(_distutils_get_PYTHONPATH)' ${DISTUTILS_USE_S= EPARATE_SOURCE_DIRECTORIES:+-s} -- ${arguments} "$@" else die "'DISTUTILS_SRC_TEST' variable has unsupported value '${DISTUTILS_SR= C_TEST}'" fi @@ -394,7 +393,7 @@ _python_initialize_prefix_variables _python_set_color_variables =20 =2D local line nspkg_pth_file nspkg_pth_files=3D() + local default_docs doc line nspkg_pth_file nspkg_pth_files=3D() setup_file =20 if _python_package_supporting_installation_for_multiple_python_abis; then distutils_installation() { @@ -402,7 +401,6 @@ =20 _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -424,7 +422,6 @@ =20 _distutils_prepare_global_options =20 =2D local setup_file for setup_file in "${DISTUTILS_SETUP_FILES[@]-setup.py}"; do _distutils_prepare_current_working_directory "${setup_file}" =20 @@ -458,10 +455,8 @@ die "Illegal installation into /usr/local" fi =20 =2D local default_docs default_docs=3D"AUTHORS Change* CHANGELOG CONTRIBUTORS KNOWN_BUGS MAINTAI= NERS NEWS README* TODO" =20 =2D local doc for doc in ${default_docs}; do [[ -s "${doc}" ]] && dodoc "${doc}" done --Boundary-01=_IbLmNhKGx/QDVxA-- --nextPart2366046.tjWInSHyVM Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJNmLbIAAoJENgZr6v6gHY0oSEQANO7AebCsjV1ZRKmH4QOD2ET 4sqtwm1D4rsGEndP0m5L5ewiSMAMBApPj0gYj6j3m1NsBqxsFREHVcf7HOtNKx+Y SG+OS8n88hn1SAh0R8LmzpWDjsiTw6jEysWjWPIGeyRYfEypCVzCBJa1ETfykKye uZFXuOQvDRADC0RUhv8nyJV4Z8gLQhINLygXc+NcX/g4TYPQtbYD6JQ2DmJ4d3oq ha7+V0O7lQHNSN5Z7ouFk0csc5N31hsvVSuxhDcQep6e+vvMGYVfERiSNYE7ZVtD V1IqTMA7/MkWbofg2sPZcMoT2IfvYCgVO0deJQky1glScpjzyB2onujNNwHaIoNd m/+TdmskWldU9yu7i8N9yK5quGm5Wk2i5QTOae59EHQJl9gwa43qBS8CeoxTbLVs xuMxDEdmOO1rtWYC5J7LeO4/dVkdgrUzeHk280G0XyblZctaMPSWUxHEgAp7FqwB 7fvAfYtcmOOHwVNDM88IuPTlG+V2qE8rsgFF7Mo78836lTiitFEnA7nRLo//PZsm kfLEgckVCVWcXw/O5kCJC/22Rtf/9qjBi7pFlKYIBJarS951Gwy8G+i7gnhYGNKO oDhbH8zhnaZBxoyAUc632JV2xtsTcnpsDaZObdCBW9UplbcGfEcAAv/SdwAUA+vz 4NrJJcbDTy33bG+Rn3xY =vS+J -----END PGP SIGNATURE----- --nextPart2366046.tjWInSHyVM--