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 1Qf5mB-00080V-6F for garchives@archives.gentoo.org; Fri, 08 Jul 2011 07:47:03 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id ED6BC21C03A; Fri, 8 Jul 2011 07:46:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B0C8C21C03A for ; Fri, 8 Jul 2011 07:46:55 +0000 (UTC) Received: from flycatcher.gentoo.org (flycatcher.gentoo.org [81.93.255.6]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id F20D42AC0C2 for ; Fri, 8 Jul 2011 07:46:54 +0000 (UTC) Received: by flycatcher.gentoo.org (Postfix, from userid 2256) id B1E202004B; Fri, 8 Jul 2011 07:46:53 +0000 (UTC) From: "Dirkjan Ochtman (djc)" To: gentoo-commits@lists.gentoo.org Reply-To: gentoo-dev@lists.gentoo.org, djc@gentoo.org Subject: [gentoo-commits] gentoo-x86 commit in eclass: python.eclass X-VCS-Repository: gentoo-x86 X-VCS-Files: python.eclass X-VCS-Directories: eclass X-VCS-Committer: djc X-VCS-Committer-Name: Dirkjan Ochtman Content-Type: text/plain; charset=utf8 Message-Id: <20110708074653.B1E202004B@flycatcher.gentoo.org> Date: Fri, 8 Jul 2011 07:46:53 +0000 (UTC) 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: X-Archives-Hash: 320ba9f156df28d9ddc2cc97151fb7aa djc 11/07/08 07:46:53 Modified: python.eclass Log: Add python_get_implementation_and_version(). (Patch by Arfrever. Backported from python overlay.) Revision Changes Path 1.124 eclass/python.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.ecla= ss?rev=3D1.124&view=3Dmarkup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.ecla= ss?rev=3D1.124&content-type=3Dtext/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python.ecla= ss?r1=3D1.123&r2=3D1.124 Index: python.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/python.eclass,v retrieving revision 1.123 retrieving revision 1.124 diff -u -r1.123 -r1.124 --- python.eclass 8 Jul 2011 07:44:52 -0000 1.123 +++ python.eclass 8 Jul 2011 07:46:53 -0000 1.124 @@ -1,6 +1,6 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.123 2011/07/= 08 07:44:52 djc Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.124 2011/07/= 08 07:46:53 djc Exp $ =20 # @ECLASS: python.eclass # @MAINTAINER: @@ -1000,7 +1000,7 @@ for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do if [[ "${EBUILD_PHASE}" =3D=3D "test" ]] && _python_check_python_abi_m= atching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"= ; then if [[ "${quiet}" =3D=3D "0" ]]; then - echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} wit= h $(python_get_implementation) $(python_get_version) skipped${_NORMAL}" + echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} wit= h $(python_get_implementation_and_version) skipped${_NORMAL}" fi continue fi @@ -1011,7 +1011,7 @@ if [[ -n "${action_message_template}" ]]; then eval "action_message=3D\"${action_message_template}\"" else - action_message=3D"${action} of ${CATEGORY}/${PF} with $(python_get_i= mplementation) $(python_get_version)..." + action_message=3D"${action} of ${CATEGORY}/${PF} with $(python_get_i= mplementation_and_version)..." fi echo " ${_GREEN}*${_NORMAL} ${_BLUE}${action_message}${_NORMAL}" fi @@ -1045,7 +1045,7 @@ if [[ -n "${failure_message_template}" ]]; then eval "failure_message=3D\"${failure_message_template}\"" else - failure_message=3D"${action} failed with $(python_get_implementation= ) $(python_get_version) in ${function}() function" + failure_message=3D"${action} failed with $(python_get_implementation= _and_version) in ${function}() function" fi =20 if [[ "${nonfatal}" =3D=3D "1" ]]; then @@ -2143,10 +2143,10 @@ # @FUNCTION: python_get_version # @USAGE: [-f|--final-ABI] [-l|--language] [--full] [--major] [--minor] = [--micro] # @DESCRIPTION: -# Print Python version. +# Print version of Python implementation. # --full, --major, --minor and --micro options cannot be specified simul= taneously. # If --full, --major, --minor and --micro options are not specified, the= n "${major_version}.${minor_version}" is printed. -# If --language option is specified, then Python language version is pri= nted. +# If --language option is specified, then version of Python language is = printed. # --language and --full options cannot be specified simultaneously. # --language and --micro options cannot be specified simultaneously. # If --final-ABI option is specified, then final ABI from the list of en= abled ABIs is used. @@ -2246,6 +2246,55 @@ fi } =20 +# @FUNCTION: python_get_implementation_and_version +# @USAGE: [-f|--final-ABI] +# @DESCRIPTION: +# Print name and version of Python implementation. +# If version of Python implementation is not bound to version of Python = language, then +# version of Python language is additionally printed. +# If --final-ABI option is specified, then final ABI from the list of en= abled ABIs is used. +python_get_implementation_and_version() { + _python_check_python_pkg_setup_execution + + local final_ABI=3D"0" PYTHON_ABI=3D"${PYTHON_ABI}" + + while (($#)); do + case "$1" in + -f|--final-ABI) + final_ABI=3D"1" + ;; + -*) + die "${FUNCNAME}(): Unrecognized option '$1'" + ;; + *) + die "${FUNCNAME}(): Invalid usage" + ;; + esac + shift + done + + if [[ "${final_ABI}" =3D=3D "1" ]]; then + if ! _python_package_supporting_installation_for_multiple_python_abis;= then + die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of= packages not supporting installation for multiple Python ABIs" + fi + PYTHON_ABI=3D"$(PYTHON -f --ABI)" + else + if _python_package_supporting_installation_for_multiple_python_abis; t= hen + if ! _python_abi-specific_local_scope; then + die "${FUNCNAME}() should be used in ABI-specific local scope" + fi + else + PYTHON_ABI=3D"${PYTHON_ABI:-$(PYTHON --ABI)}" + fi + fi + + if [[ "${PYTHON_ABI}" =3D~ ^[[:digit:]]+\.[[:digit:]]+-[[:alnum:]]+-[[:= digit:]]+\.[[:digit:]]+$ ]]; then + echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI##*-} = (Python ${PYTHON_ABI%%-*})" + else + echo "$(_python_get_implementation "${PYTHON_ABI}") ${PYTHON_ABI%%-*}" + fi +} + # =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=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 FUNCTIONS FOR RUNNING OF TESTS =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=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 @@ -2704,7 +2753,7 @@ if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})) ||= ((${#evaluated_dirs[@]})) || ((${#evaluated_files[@]})); then return_code=3D"0" stderr=3D"" - ebegin "Compilation and optimization of Python modules for $(python_= get_implementation) $(python_get_version)" + ebegin "Compilation and optimization of Python modules for $(python_= get_implementation_and_version)" if ((${#site_packages_dirs[@]})) || ((${#evaluated_dirs[@]})); then for dir in "${site_packages_dirs[@]}"; do dirs+=3D("${root}$(python_get_sitedir)/${dir}") @@ -2733,7 +2782,7 @@ fi eend "${return_code}" if [[ -n "${stderr}" ]]; then - eerror "Syntax errors / warnings in Python modules for $(python_get= _implementation) $(python_get_version):" &> /dev/null + eerror "Syntax errors / warnings in Python modules for $(python_get= _implementation_and_version):" &> /dev/null while read stderr_line; do eerror " ${stderr_line}" done <<< "${stderr}" @@ -2754,7 +2803,7 @@ if ((${#other_dirs[@]})) || ((${#other_files[@]})); then return_code=3D"0" stderr=3D"" - ebegin "Compilation and optimization of Python modules placed outside= of site-packages directories for $(python_get_implementation) $(python_g= et_version)" + ebegin "Compilation and optimization of Python modules placed outside= of site-packages directories for $(python_get_implementation_and_version= )" if ((${#other_dirs[@]})); then stderr+=3D"${stderr:+$'\n'}$("$(PYTHON ${PYTHON_ABI})" "${root}$(pyt= hon_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" 2>&1)" = || return_code=3D"1" if [[ "$(_python_get_implementation "${PYTHON_ABI}")" !=3D "Jython" = ]]; then @@ -2771,7 +2820,7 @@ fi eend "${return_code}" if [[ -n "${stderr}" ]]; then - eerror "Syntax errors / warnings in Python modules placed outside of= site-packages directories for $(python_get_implementation) $(python_get_= version):" &> /dev/null + eerror "Syntax errors / warnings in Python modules placed outside of= site-packages directories for $(python_get_implementation_and_version):"= &> /dev/null while read stderr_line; do eerror " ${stderr_line}" done <<< "${stderr}"