/[gentoo-x86]/eclass/python.eclass
Gentoo

Diff of /eclass/python.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.114 Revision 1.116
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.114 2011/07/04 11:00:52 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.116 2011/07/04 11:27:53 djc Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: Eclass for Python packages 8# @BLURB: Eclass for Python packages
23# ================================================================================================ 23# ================================================================================================
24# ===================================== HANDLING OF METADATA ===================================== 24# ===================================== HANDLING OF METADATA =====================================
25# ================================================================================================ 25# ================================================================================================
26 26
27_python_check_python_abi_matching() { 27_python_check_python_abi_matching() {
28 local pattern patterns patterns_list="0" PYTHON_ABI
29
30 while (($#)); do
31 case "$1" in
32 --patterns-list)
33 patterns_list="1"
34 ;;
35 --)
36 shift
37 break
38 ;;
39 -*)
40 die "${FUNCNAME}(): Unrecognized option '$1'"
41 ;;
42 *)
43 break
44 ;;
45 esac
46 shift
47 done
48
28 if [[ "$#" -ne 2 ]]; then 49 if [[ "$#" -ne 2 ]]; then
29 die "${FUNCNAME}() requires 2 arguments" 50 die "${FUNCNAME}() requires 2 arguments"
30 fi 51 fi
31 52
53 PYTHON_ABI="$1"
54
55 if [[ "${patterns_list}" == "0" ]]; then
56 pattern="$2"
57
32 if [[ "$2" == *"-cpython" ]]; then 58 if [[ "${pattern}" == *"-cpython" ]]; then
33 [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "$1" == ${2%-cpython} ]] 59 [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ && "${PYTHON_ABI}" == ${pattern%-cpython} ]]
34 elif [[ "$2" == *"-jython" ]]; then 60 elif [[ "${pattern}" == *"-jython" ]]; then
35 [[ "$1" == $2 ]] 61 [[ "${PYTHON_ABI}" == ${pattern} ]]
36 else
37 if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
38 [[ "$1" == $2 ]]
39 elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
40 [[ "${1%-jython}" == $2 ]]
41 else 62 else
63 if [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
64 [[ "${PYTHON_ABI}" == ${pattern} ]]
65 elif [[ "${PYTHON_ABI}" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
66 [[ "${PYTHON_ABI%-jython}" == ${pattern} ]]
67 else
42 die "${FUNCNAME}(): Unrecognized Python ABI '$1'" 68 die "${FUNCNAME}(): Unrecognized Python ABI '${PYTHON_ABI}'"
43 fi 69 fi
70 fi
71 else
72 patterns="${2// /$'\n'}"
73
74 while read pattern; do
75 if _python_check_python_abi_matching "${PYTHON_ABI}" "${pattern}"; then
76 return 0
77 fi
78 done <<< "${patterns}"
79
80 return 1
44 fi 81 fi
45} 82}
46 83
47# @ECLASS-VARIABLE: PYTHON_DEPEND 84# @ECLASS-VARIABLE: PYTHON_DEPEND
48# @DESCRIPTION: 85# @DESCRIPTION:
582 619
583# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS 620# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
584# @DESCRIPTION: 621# @DESCRIPTION:
585# Set this in EAPI <= 4 to indicate that current package supports installation for 622# Set this in EAPI <= 4 to indicate that current package supports installation for
586# multiple Python ABIs. 623# multiple Python ABIs.
624
625# @ECLASS-VARIABLE: PYTHON_TESTS_RESTRICTED_ABIS
626# @DESCRIPTION:
627# Space-separated list of Python ABI patterns. Testing in Python ABIs matching any Python ABI
628# patterns specified in this list is skipped.
587 629
588# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS 630# @ECLASS-VARIABLE: PYTHON_EXPORT_PHASE_FUNCTIONS
589# @DESCRIPTION: 631# @DESCRIPTION:
590# Set this to export phase functions for the following ebuild phases: 632# Set this to export phase functions for the following ebuild phases:
591# src_prepare(), src_configure(), src_compile(), src_test(), src_install(). 633# src_prepare(), src_configure(), src_compile(), src_test(), src_install().
971 iterated_PYTHON_ABIS="$(PYTHON -f --ABI)" 1013 iterated_PYTHON_ABIS="$(PYTHON -f --ABI)"
972 else 1014 else
973 iterated_PYTHON_ABIS="${PYTHON_ABIS}" 1015 iterated_PYTHON_ABIS="${PYTHON_ABIS}"
974 fi 1016 fi
975 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do 1017 for PYTHON_ABI in ${iterated_PYTHON_ABIS}; do
1018 if [[ "${EBUILD_PHASE}" == "test" ]] && _python_check_python_abi_matching --patterns-list "${PYTHON_ABI}" "${PYTHON_TESTS_RESTRICTED_ABIS}"; then
1019 if [[ "${quiet}" == "0" ]]; then
1020 echo " ${_GREEN}*${_NORMAL} ${_BLUE}Testing of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version) skipped${_NORMAL}"
1021 fi
1022 continue
1023 fi
1024
976 _python_prepare_flags 1025 _python_prepare_flags
977 1026
978 if [[ "${quiet}" == "0" ]]; then 1027 if [[ "${quiet}" == "0" ]]; then
979 if [[ -n "${action_message_template}" ]]; then 1028 if [[ -n "${action_message_template}" ]]; then
980 eval "action_message=\"${action_message_template}\"" 1029 eval "action_message=\"${action_message_template}\""

Legend:
Removed from v.1.114  
changed lines
  Added in v.1.116

  ViewVC Help
Powered by ViewVC 1.1.20