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

Diff of /eclass/python.eclass

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

Revision 1.87 Revision 1.88
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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.87 2010/02/02 18:55:00 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.88 2010/02/11 18:52:44 arfrever Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: A utility eclass that should be inherited by anything that deals with Python or Python modules. 8# @BLURB: Eclass for Python packages
9# @DESCRIPTION: 9# @DESCRIPTION:
10# Some useful functions for dealing with Python. 10# The python eclass contains miscellaneous, useful functions for Python packages.
11 11
12inherit multilib 12inherit multilib
13 13
14if ! has "${EAPI:-0}" 0 1 2 3; then 14if ! has "${EAPI:-0}" 0 1 2 3; then
15 die "API of python.eclass in EAPI=\"${EAPI}\" not established" 15 die "API of python.eclass in EAPI=\"${EAPI}\" not established"
16fi 16fi
17 17
18_PYTHON2_SUPPORTED_VERSIONS=(2.4 2.5 2.6 2.7) 18_CPYTHON2_SUPPORTED_ABIS=(2.4 2.5 2.6 2.7)
19_PYTHON3_SUPPORTED_VERSIONS=(3.0 3.1 3.2) 19_CPYTHON3_SUPPORTED_ABIS=(3.0 3.1 3.2)
20_JYTHON_SUPPORTED_ABIS=(2.5-jython)
20 21
21# @ECLASS-VARIABLE: PYTHON_DEPEND 22# @ECLASS-VARIABLE: PYTHON_DEPEND
22# @DESCRIPTION: 23# @DESCRIPTION:
23# Specification of dependency on dev-lang/python. 24# Specification of dependency on dev-lang/python.
24# Syntax: 25# Syntax:
27# major_version: <2|3|*> 28# major_version: <2|3|*>
28# minimal_version: <minimal_major_version.minimal_minor_version> 29# minimal_version: <minimal_major_version.minimal_minor_version>
29# maximal_version: <maximal_major_version.maximal_minor_version> 30# maximal_version: <maximal_major_version.maximal_minor_version>
30 31
31_parse_PYTHON_DEPEND() { 32_parse_PYTHON_DEPEND() {
32 local accepted_version accepted_versions=() major_version maximal_version minimal_version python_all="0" python_atoms= python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups 33 local major_version maximal_version minimal_version python_all="0" python_maximal_version python_minimal_version python_versions=() python2="0" python2_maximal_version python2_minimal_version python3="0" python3_maximal_version python3_minimal_version USE_flag= version_components_group version_components_group_regex version_components_groups
33 34
34 version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?" 35 version_components_group_regex="(2|3|\*)(:([[:digit:]]+\.[[:digit:]]+)?(:([[:digit:]]+\.[[:digit:]]+)?)?)?"
35 version_components_groups="${PYTHON_DEPEND}" 36 version_components_groups="${PYTHON_DEPEND}"
36 37
37 if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then 38 if [[ "${version_components_groups}" =~ ^((\!)?[[:alnum:]_-]+\?\ )?${version_components_group_regex}(\ ${version_components_group_regex})?$ ]]; then
59 fi 60 fi
60 fi 61 fi
61 62
62 if [[ "${major_version}" == "2" ]]; then 63 if [[ "${major_version}" == "2" ]]; then
63 python2="1" 64 python2="1"
64 python_versions=("${_PYTHON2_SUPPORTED_VERSIONS[@]}") 65 python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}")
65 python2_minimal_version="${minimal_version}" 66 python2_minimal_version="${minimal_version}"
66 python2_maximal_version="${maximal_version}" 67 python2_maximal_version="${maximal_version}"
67 elif [[ "${major_version}" == "3" ]]; then 68 elif [[ "${major_version}" == "3" ]]; then
68 python3="1" 69 python3="1"
69 python_versions=("${_PYTHON3_SUPPORTED_VERSIONS[@]}") 70 python_versions=("${_CPYTHON3_SUPPORTED_ABIS[@]}")
70 python3_minimal_version="${minimal_version}" 71 python3_minimal_version="${minimal_version}"
71 python3_maximal_version="${maximal_version}" 72 python3_maximal_version="${maximal_version}"
72 else 73 else
73 python_all="1" 74 python_all="1"
74 python_versions=("${_PYTHON2_SUPPORTED_VERSIONS[@]}" "${_PYTHON3_SUPPORTED_VERSIONS[@]}") 75 python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}" "${_CPYTHON3_SUPPORTED_ABIS[@]}")
75 python_minimal_version="${minimal_version}" 76 python_minimal_version="${minimal_version}"
76 python_maximal_version="${maximal_version}" 77 python_maximal_version="${maximal_version}"
77 fi 78 fi
78 79
79 if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then 80 if [[ -n "${minimal_version}" ]] && ! has "${minimal_version}" "${python_versions[@]}"; then
86 if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then 87 if [[ -n "${minimal_version}" && -n "${maximal_version}" && "${minimal_version}" > "${maximal_version}" ]]; then
87 die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'" 88 die "Invalid syntax of PYTHON_DEPEND: Minimal version '${minimal_version}' greater than maximal version '${maximal_version}'"
88 fi 89 fi
89 done <<< "${version_components_groups}" 90 done <<< "${version_components_groups}"
90 91
92 _PYTHON_ATOMS=()
93
91 _create_accepted_versions_range() { 94 _append_accepted_versions_range() {
92 local accepted_version="0" i 95 local accepted_version="0" i
93 for ((i = "${#python_versions[@]}"; i >= 0; i--)); do 96 for ((i = "${#python_versions[@]}"; i >= 0; i--)); do
94 if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then 97 if [[ "${python_versions[${i}]}" == "${python_maximal_version}" ]]; then
95 accepted_version="1" 98 accepted_version="1"
96 fi 99 fi
97 if [[ "${accepted_version}" == "1" ]]; then 100 if [[ "${accepted_version}" == "1" ]]; then
98 accepted_versions+=("${python_versions[${i}]}") 101 _PYTHON_ATOMS+=("=dev-lang/python-${python_versions[${i}]}*")
99 fi 102 fi
100 if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then 103 if [[ "${python_versions[${i}]}" == "${python_minimal_version}" ]]; then
101 accepted_version="0" 104 accepted_version="0"
102 fi 105 fi
103 done 106 done
104 } 107 }
105 108
106 if [[ "${python_all}" == "1" ]]; then 109 if [[ "${python_all}" == "1" ]]; then
110 if [[ -z "${python_minimal_version}" && -z "${python_maximal_version}" ]]; then
111 _PYTHON_ATOMS+=("dev-lang/python")
112 else
107 python_versions=("${_PYTHON2_SUPPORTED_VERSIONS[@]}" "${_PYTHON3_SUPPORTED_VERSIONS[@]}") 113 python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}" "${_CPYTHON3_SUPPORTED_ABIS[@]}")
108 python_minimal_version="${python_minimal_version:-${python_versions[0]}}" 114 python_minimal_version="${python_minimal_version:-${python_versions[0]}}"
109 python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" 115 python_maximal_version="${python_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
110 _create_accepted_versions_range 116 _append_accepted_versions_range
117 fi
111 else 118 else
112 if [[ "${python3}" == "1" ]]; then 119 if [[ "${python3}" == "1" ]]; then
120 if [[ -z "${python3_minimal_version}" && -z "${python3_maximal_version}" ]]; then
121 _PYTHON_ATOMS+=("=dev-lang/python-3*")
122 else
113 python_versions=("${_PYTHON3_SUPPORTED_VERSIONS[@]}") 123 python_versions=("${_CPYTHON3_SUPPORTED_ABIS[@]}")
114 python_minimal_version="${python3_minimal_version:-${python_versions[0]}}" 124 python_minimal_version="${python3_minimal_version:-${python_versions[0]}}"
115 python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" 125 python_maximal_version="${python3_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
116 _create_accepted_versions_range 126 _append_accepted_versions_range
127 fi
117 fi 128 fi
118 if [[ "${python2}" == "1" ]]; then 129 if [[ "${python2}" == "1" ]]; then
130 if [[ -z "${python2_minimal_version}" && -z "${python2_maximal_version}" ]]; then
131 _PYTHON_ATOMS+=("=dev-lang/python-2*")
132 else
119 python_versions=("${_PYTHON2_SUPPORTED_VERSIONS[@]}") 133 python_versions=("${_CPYTHON2_SUPPORTED_ABIS[@]}")
120 python_minimal_version="${python2_minimal_version:-${python_versions[0]}}" 134 python_minimal_version="${python2_minimal_version:-${python_versions[0]}}"
121 python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}" 135 python_maximal_version="${python2_maximal_version:-${python_versions[${#python_versions[@]}-1]}}"
122 _create_accepted_versions_range 136 _append_accepted_versions_range
123 fi 137 fi
124 fi 138 fi
139 fi
125 140
126 for accepted_version in "${accepted_versions[@]}"; do 141 unset -f _append_accepted_versions_range
127 python_atoms+="${python_atoms:+ }=dev-lang/python-${accepted_version}*"
128 done
129 142
130 _PYTHON_ATOMS="${python_atoms// /$'\n'}" 143 if [[ "${#_PYTHON_ATOMS[@]}" -gt 1 ]]; then
131 DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${python_atoms} )${USE_flag:+ )}" 144 DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
132 RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${python_atoms} )${USE_flag:+ )}" 145 RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }|| ( ${_PYTHON_ATOMS[@]} )${USE_flag:+ )}"
146 else
147 DEPEND+="${DEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
148 RDEPEND+="${RDEPEND:+ }${USE_flag}${USE_flag:+? ( }${_PYTHON_ATOMS[@]}${USE_flag:+ )}"
149 fi
133 else 150 else
134 die "Invalid syntax of PYTHON_DEPEND" 151 die "Invalid syntax of PYTHON_DEPEND"
135 fi 152 fi
136} 153}
137 154
145elif [[ -n "${NEED_PYTHON}" ]]; then 162elif [[ -n "${NEED_PYTHON}" ]]; then
146 if ! has "${EAPI:-0}" 0 1 2; then 163 if ! has "${EAPI:-0}" 0 1 2; then
147 eerror "Use PYTHON_DEPEND instead of NEED_PYTHON." 164 eerror "Use PYTHON_DEPEND instead of NEED_PYTHON."
148 die "NEED_PYTHON cannot be used in this EAPI" 165 die "NEED_PYTHON cannot be used in this EAPI"
149 fi 166 fi
150 _PYTHON_ATOMS=">=dev-lang/python-${NEED_PYTHON}" 167 _PYTHON_ATOMS=(">=dev-lang/python-${NEED_PYTHON}")
151 DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS}" 168 DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS[@]}"
152 RDEPEND+="${RDEPEND:+ }${_PYTHON_ATOMS}" 169 RDEPEND+="${RDEPEND:+ }${_PYTHON_ATOMS[@]}"
153else 170else
154 _PYTHON_ATOMS="dev-lang/python" 171 _PYTHON_ATOMS=("dev-lang/python")
155fi 172fi
156 173
157# @ECLASS-VARIABLE: PYTHON_USE_WITH 174# @ECLASS-VARIABLE: PYTHON_USE_WITH
158# @DESCRIPTION: 175# @DESCRIPTION:
159# Set this to a space separated list of USE flags the Python slot in use must be built with. 176# Set this to a space separated list of USE flags the Python slot in use must be built with.
180 197
181 [[ ${PYTHON_USE_WITH_OPT} ]] && use !${PYTHON_USE_WITH_OPT} && return 198 [[ ${PYTHON_USE_WITH_OPT} ]] && use !${PYTHON_USE_WITH_OPT} && return
182 199
183 python_pkg_setup_check_USE_flags() { 200 python_pkg_setup_check_USE_flags() {
184 local pyatom use 201 local pyatom use
185 if [[ -n "${PYTHON_ABI}" ]]; then 202 pyatom="$(python_get_implementational_package)"
186 pyatom="dev-lang/python:${PYTHON_ABI}"
187 else
188 pyatom="dev-lang/python:$(PYTHON -A --ABI)"
189 fi
190 203
191 for use in ${PYTHON_USE_WITH}; do 204 for use in ${PYTHON_USE_WITH}; do
192 if ! has_version "${pyatom}[${use}]"; then 205 if ! has_version "${pyatom}[${use}]"; then
193 python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}" 206 python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
194 fi 207 fi
203 if [[ ${PYTHON_USE_WITH_OR} ]]; then 216 if [[ ${PYTHON_USE_WITH_OR} ]]; then
204 python_pkg_setup_fail "Please rebuild ${pyatom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}" 217 python_pkg_setup_fail "Please rebuild ${pyatom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
205 fi 218 fi
206 } 219 }
207 220
208 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 221 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
209 python_execute_function -q python_pkg_setup_check_USE_flags 222 python_execute_function -q python_pkg_setup_check_USE_flags
210 else 223 else
211 python_pkg_setup_check_USE_flags 224 python_pkg_setup_check_USE_flags
212 fi 225 fi
226
227 unset -f python_pkg_setup_check_USE_flags python_pkg_setup_fail
213 } 228 }
214 229
215 EXPORT_FUNCTIONS pkg_setup 230 EXPORT_FUNCTIONS pkg_setup
216 231
217 _PYTHON_USE_WITH_ATOM="" 232 _PYTHON_USE_WITH_ATOM=""
218 if [[ -n "${PYTHON_USE_WITH}" ]]; then 233 if [[ -n "${PYTHON_USE_WITH}" ]]; then
219 while read _PYTHON_ATOM; do 234 for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
220 _PYTHON_USE_WITH_ATOM+="${_PYTHON_USE_WITH_ATOM:+ }${_PYTHON_ATOM}[${PYTHON_USE_WITH/ /,}]" 235 _PYTHON_USE_WITH_ATOM+="${_PYTHON_USE_WITH_ATOM:+ }${_PYTHON_ATOM}[${PYTHON_USE_WITH/ /,}]"
221 done <<< "${_PYTHON_ATOMS}" 236 done
222 _PYTHON_USE_WITH_ATOM="|| ( ${_PYTHON_USE_WITH_ATOM} )" 237 _PYTHON_USE_WITH_ATOM="|| ( ${_PYTHON_USE_WITH_ATOM} )"
223 elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then 238 elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then
224 for _USE_flag in ${PYTHON_USE_WITH_OR}; do 239 for _USE_flag in ${PYTHON_USE_WITH_OR}; do
225 while read _PYTHON_ATOM; do 240 for _PYTHON_ATOM in "${_PYTHON_ATOMS[@]}"; do
226 _PYTHON_USE_WITH_ATOM+="${_PYTHON_USE_WITH_ATOM:+ }${_PYTHON_ATOM}[${_USE_flag}]" 241 _PYTHON_USE_WITH_ATOM+="${_PYTHON_USE_WITH_ATOM:+ }${_PYTHON_ATOM}[${_USE_flag}]"
227 done <<< "${_PYTHON_ATOMS}" 242 done
228 done 243 done
229 unset _USE_flag 244 unset _USE_flag
230 _PYTHON_USE_WITH_ATOM="|| ( ${_PYTHON_USE_WITH_ATOM} )" 245 _PYTHON_USE_WITH_ATOM="|| ( ${_PYTHON_USE_WITH_ATOM} )"
231 fi 246 fi
232 if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then 247 if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then
243# ======== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ======== 258# ======== FUNCTIONS FOR PACKAGES SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ========
244# ================================================================================================ 259# ================================================================================================
245 260
246# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS 261# @ECLASS-VARIABLE: SUPPORT_PYTHON_ABIS
247# @DESCRIPTION: 262# @DESCRIPTION:
248# Set this in EAPI <= 4 to indicate that given package supports installation for 263# Set this in EAPI <= 4 to indicate that current package supports installation for
249# multiple versions of Python. 264# multiple versions of Python.
250 265
251# @ECLASS-VARIABLE: PYTHON_DEFINE_DEFAULT_FUNCTIONS 266# @ECLASS-VARIABLE: PYTHON_DEFINE_DEFAULT_FUNCTIONS
252# @DESCRIPTION: 267# @DESCRIPTION:
253# Set this to define default functions for the following ebuild phases: 268# Set this to define default functions for the following ebuild phases:
291 fi 306 fi
292 307
293 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5. 308 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 5.
294 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then 309 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3 4; then
295 local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS= 310 local PYTHON_ABI restricted_ABI support_ABI supported_PYTHON_ABIS=
296 PYTHON_ABI_SUPPORTED_VALUES="${_PYTHON2_SUPPORTED_VERSIONS[@]} ${_PYTHON3_SUPPORTED_VERSIONS[@]}" 311 PYTHON_ABI_SUPPORTED_VALUES="${_CPYTHON2_SUPPORTED_ABIS[@]} ${_CPYTHON3_SUPPORTED_ABIS[@]} ${_JYTHON_SUPPORTED_ABIS[@]}"
297 312
298 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then 313 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
299 local python2_enabled="0" python3_enabled="0" 314 local python2_enabled="0" python3_enabled="0"
300 315
301 if [[ -z "${USE_PYTHON}" ]]; then 316 if [[ -z "${USE_PYTHON}" ]]; then
305 for PYTHON_ABI in ${USE_PYTHON}; do 320 for PYTHON_ABI in ${USE_PYTHON}; do
306 if ! has "${PYTHON_ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then 321 if ! has "${PYTHON_ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
307 die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'" 322 die "USE_PYTHON variable contains invalid value '${PYTHON_ABI}'"
308 fi 323 fi
309 324
310 if has "${PYTHON_ABI}" "${_PYTHON2_SUPPORTED_VERSIONS[@]}"; then 325 if has "${PYTHON_ABI}" "${_CPYTHON2_SUPPORTED_ABIS[@]}"; then
311 python2_enabled="1" 326 python2_enabled="1"
312 fi 327 fi
313 if has "${PYTHON_ABI}" "${_PYTHON3_SUPPORTED_VERSIONS[@]}"; then 328 if has "${PYTHON_ABI}" "${_CPYTHON3_SUPPORTED_ABIS[@]}"; then
314 python3_enabled="1" 329 python3_enabled="1"
315 fi 330 fi
316 331
317 support_ABI="1" 332 support_ABI="1"
318 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do 333 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
332 ewarn "USE_PYTHON variable does not enable any version of Python 2. This configuration is unsupported." 347 ewarn "USE_PYTHON variable does not enable any version of Python 2. This configuration is unsupported."
333 fi 348 fi
334 if [[ "${python3_enabled}" == "0" ]]; then 349 if [[ "${python3_enabled}" == "0" ]]; then
335 ewarn "USE_PYTHON variable does not enable any version of Python 3. This configuration is unsupported." 350 ewarn "USE_PYTHON variable does not enable any version of Python 3. This configuration is unsupported."
336 fi 351 fi
352 if [[ "${python2_enabled}" == "0" && "${python3_enabled}" == "0" ]]; then
353 die "USE_PYTHON variable does not enable any version of CPython"
354 fi
337 else 355 else
338 local python_version python2_version= python3_version= support_python_major_version 356 local python_version python2_version= python3_version= support_python_major_version
339 357
340 python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" 358 python_version="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
341 359
342 if has_version "=dev-lang/python-2*"; then 360 if has_version "=dev-lang/python-2*"; then
343 if [[ "$(readlink "${EPREFIX}/usr/bin/python2")" != "python2."* ]]; then 361 if [[ "$(readlink "${EPREFIX}/usr/bin/python2")" != "python2."* ]]; then
344 die "'${EPREFIX}/usr/bin/python2' is not valid symlink" 362 die "'${EPREFIX}/usr/bin/python2' is not valid symlink"
345 fi 363 fi
346 364
347 python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" 365 python2_version="$("${EPREFIX}/usr/bin/python2" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
348 366
349 for PYTHON_ABI in "${_PYTHON2_SUPPORTED_VERSIONS[@]}"; do 367 for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; do
350 support_python_major_version="1" 368 support_python_major_version="1"
351 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do 369 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
352 if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then 370 if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
353 support_python_major_version="0" 371 support_python_major_version="0"
354 fi 372 fi
369 if has_version "=dev-lang/python-3*"; then 387 if has_version "=dev-lang/python-3*"; then
370 if [[ "$(readlink "${EPREFIX}/usr/bin/python3")" != "python3."* ]]; then 388 if [[ "$(readlink "${EPREFIX}/usr/bin/python3")" != "python3."* ]]; then
371 die "'${EPREFIX}/usr/bin/python3' is not valid symlink" 389 die "'${EPREFIX}/usr/bin/python3' is not valid symlink"
372 fi 390 fi
373 391
374 python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" 392 python3_version="$("${EPREFIX}/usr/bin/python3" -c 'from sys import version_info; print(".".join(str(x) for x in version_info[:2]))')"
375 393
376 for PYTHON_ABI in "${_PYTHON3_SUPPORTED_VERSIONS[@]}"; do 394 for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; do
377 support_python_major_version="1" 395 support_python_major_version="1"
378 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do 396 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
379 if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then 397 if [[ "${PYTHON_ABI}" == ${restricted_ABI} ]]; then
380 support_python_major_version="0" 398 support_python_major_version="0"
381 fi 399 fi
412 430
413 if ! _python_implementation && [[ "$(declare -p PYTHON_ABIS_SANITY_CHECKS 2> /dev/null)" != "declare -- PYTHON_ABIS_SANITY_CHECKS="* ]]; then 431 if ! _python_implementation && [[ "$(declare -p PYTHON_ABIS_SANITY_CHECKS 2> /dev/null)" != "declare -- PYTHON_ABIS_SANITY_CHECKS="* ]]; then
414 local PYTHON_ABI 432 local PYTHON_ABI
415 for PYTHON_ABI in ${PYTHON_ABIS}; do 433 for PYTHON_ABI in ${PYTHON_ABIS}; do
416 # Ensure that appropriate version of Python is installed. 434 # Ensure that appropriate version of Python is installed.
417 if ! has_version "dev-lang/python:${PYTHON_ABI}"; then 435 if ! has_version "$(python_get_implementational_package)"; then
418 die "dev-lang/python:${PYTHON_ABI} is not installed" 436 die "$(python_get_implementational_package) is not installed"
419 fi 437 fi
420 438
421 # Ensure that EPYTHON variable is respected. 439 # Ensure that EPYTHON variable is respected.
422 if [[ "$(EPYTHON="$(PYTHON)" python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" != "${PYTHON_ABI}" ]]; then 440 if [[ "$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")" != "${PYTHON_ABI}" ]]; then
423 eerror "python: '$(type -p python)'" 441 eerror "python: '$(type -p python)'"
424 eerror "ABI: '${ABI}'" 442 eerror "ABI: '${ABI}'"
425 eerror "DEFAULT_ABI: '${DEFAULT_ABI}'" 443 eerror "DEFAULT_ABI: '${DEFAULT_ABI}'"
426 eerror "EPYTHON: '$(PYTHON)'" 444 eerror "EPYTHON: '$(PYTHON)'"
427 eerror "PYTHON_ABI: '${PYTHON_ABI}'" 445 eerror "PYTHON_ABI: '${PYTHON_ABI}'"
428 eerror "Version of enabled Python: '$(EPYTHON="$(PYTHON)" python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')'" 446 eerror "Version of enabled Python: '$(EPYTHON="$(PYTHON)" python -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")'"
429 die "'python' does not respect EPYTHON variable" 447 die "'python' does not respect EPYTHON variable"
430 fi 448 fi
431 done 449 done
432 PYTHON_ABIS_SANITY_CHECKS="1" 450 PYTHON_ABIS_SANITY_CHECKS="1"
433 fi 451 fi
534 fi 552 fi
535 function="python_default_function" 553 function="python_default_function"
536 fi 554 fi
537 555
538 for ((i = 1; i < "${#FUNCNAME[@]}"; i++)); do 556 for ((i = 1; i < "${#FUNCNAME[@]}"; i++)); do
539 if [[ "${FUNCNAME[${i}]}" == "python_execute_function" ]]; then 557 if [[ "${FUNCNAME[${i}]}" == "${FUNCNAME}" ]]; then
540 die "${FUNCNAME}(): Invalid call stack" 558 die "${FUNCNAME}(): Invalid call stack"
541 fi 559 fi
542 done 560 done
543 561
544 if [[ "${quiet}" == "0" ]]; then 562 if [[ "${quiet}" == "0" ]]; then
572 for PYTHON_ABI in ${PYTHON_ABIS}; do 590 for PYTHON_ABI in ${PYTHON_ABIS}; do
573 if [[ "${quiet}" == "0" ]]; then 591 if [[ "${quiet}" == "0" ]]; then
574 if [[ -n "${action_message_template}" ]]; then 592 if [[ -n "${action_message_template}" ]]; then
575 action_message="$(eval echo -n "${action_message_template}")" 593 action_message="$(eval echo -n "${action_message_template}")"
576 else 594 else
577 action_message="${action} of ${CATEGORY}/${PF} with Python ${PYTHON_ABI}..." 595 action_message="${action} of ${CATEGORY}/${PF} with $(python_get_implementation) $(python_get_version)..."
578 fi 596 fi
579 echo " ${GREEN}*${NORMAL} ${BLUE}${action_message}${NORMAL}" 597 echo " ${GREEN}*${NORMAL} ${BLUE}${action_message}${NORMAL}"
580 fi 598 fi
581 599
582 if [[ "${separate_build_dirs}" == "1" ]]; then 600 if [[ "${separate_build_dirs}" == "1" ]]; then
602 620
603 if [[ "$?" != "0" ]]; then 621 if [[ "$?" != "0" ]]; then
604 if [[ -n "${failure_message_template}" ]]; then 622 if [[ -n "${failure_message_template}" ]]; then
605 failure_message="$(eval echo -n "${failure_message_template}")" 623 failure_message="$(eval echo -n "${failure_message_template}")"
606 else 624 else
607 failure_message="${action} failed with Python ${PYTHON_ABI} in ${function}() function" 625 failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function"
608 fi 626 fi
609 627
610 if [[ "${nonfatal}" == "1" ]]; then 628 if [[ "${nonfatal}" == "1" ]]; then
611 if [[ "${quiet}" == "0" ]]; then 629 if [[ "${quiet}" == "0" ]]; then
612 ewarn "${RED}${failure_message}${NORMAL}" 630 ewarn "${RED}${failure_message}${NORMAL}"
663} 681}
664 682
665# @FUNCTION: python_copy_sources 683# @FUNCTION: python_copy_sources
666# @USAGE: [--no-link] [--] [directory] 684# @USAGE: [--no-link] [--] [directory]
667# @DESCRIPTION: 685# @DESCRIPTION:
668# Copy unpacked sources of given package to separate build directory for each Python ABI. 686# Copy unpacked sources of current package to separate build directory for each Python ABI.
669python_copy_sources() { 687python_copy_sources() {
670 local dir dirs=() no_link="0" PYTHON_ABI 688 local dir dirs=() no_link="0" PYTHON_ABI
671 689
672 while (($#)); do 690 while (($#)); do
673 case "$1" in 691 case "$1" in
763 if [[ "$#" -eq 0 ]]; then 781 if [[ "$#" -eq 0 ]]; then
764 die "${FUNCNAME}(): Missing arguments" 782 die "${FUNCNAME}(): Missing arguments"
765 fi 783 fi
766 784
767 validate_PYTHON_ABIS 785 validate_PYTHON_ABIS
768 for PYTHON_ABI in "${_PYTHON2_SUPPORTED_VERSIONS[@]}"; do 786 for PYTHON_ABI in "${_CPYTHON2_SUPPORTED_ABIS[@]}"; do
769 if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then 787 if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
770 python2_enabled="1" 788 python2_enabled="1"
771 fi 789 fi
772 done 790 done
773 for PYTHON_ABI in "${_PYTHON3_SUPPORTED_VERSIONS[@]}"; do 791 for PYTHON_ABI in "${_CPYTHON3_SUPPORTED_ABIS[@]}"; do
774 if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then 792 if has "${PYTHON_ABI}" ${PYTHON_ABIS}; then
775 python3_enabled="1" 793 python3_enabled="1"
776 fi 794 fi
777 done 795 done
778 796
890# ================================================================================================ 908# ================================================================================================
891# ====== FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ====== 909# ====== FUNCTIONS FOR PACKAGES NOT SUPPORTING INSTALLATION FOR MULTIPLE VERSIONS OF PYTHON ======
892# ================================================================================================ 910# ================================================================================================
893 911
894# @FUNCTION: python_set_active_version 912# @FUNCTION: python_set_active_version
895# @USAGE: <Python_ABI|2|3> 913# @USAGE: <CPython_ABI|2|3>
896# @DESCRIPTION: 914# @DESCRIPTION:
897# Set active version of Python. 915# Set specified version of CPython as active version of Python.
898python_set_active_version() { 916python_set_active_version() {
917 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
918 die "${FUNCNAME}() cannot be used in ebuilds of packages supporting installation for multiple versions of Python"
919 fi
920
899 if [[ "$#" -ne 1 ]]; then 921 if [[ "$#" -ne 1 ]]; then
900 die "${FUNCNAME}() requires 1 argument" 922 die "${FUNCNAME}() requires 1 argument"
901 fi 923 fi
902 924
903 if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then 925 if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
927 # python-updater checks PYTHON_REQUESTED_ACTIVE_VERSION variable. 949 # python-updater checks PYTHON_REQUESTED_ACTIVE_VERSION variable.
928 PYTHON_REQUESTED_ACTIVE_VERSION="$1" 950 PYTHON_REQUESTED_ACTIVE_VERSION="$1"
929} 951}
930 952
931# @FUNCTION: python_need_rebuild 953# @FUNCTION: python_need_rebuild
932# @DESCRIPTION: Run without arguments, specifies that the package should be 954# @DESCRIPTION: Mark current package for rebuilding by python-updater after
933# rebuilt after a python upgrade. 955# switching of active version of Python.
934# Do not use this function in ebuilds of packages supporting installation
935# for multiple versions of Python.
936python_need_rebuild() { 956python_need_rebuild() {
937 export PYTHON_NEED_REBUILD="$(PYTHON -A --ABI)" 957 export PYTHON_NEED_REBUILD="$(PYTHON -A --ABI)"
938} 958}
939 959
940# ================================================================================================ 960# ================================================================================================
941# ======================================= GETTER FUNCTIONS ======================================= 961# ======================================= GETTER FUNCTIONS =======================================
942# ================================================================================================ 962# ================================================================================================
943 963
964_PYTHON_ABI_EXTRACTION_COMMAND='import platform
965import sys
966sys.stdout.write(".".join(str(x) for x in sys.version_info[:2]))
967if platform.system()[:4] == "Java":
968 sys.stdout.write("-jython")'
969
970_python_get_implementation() {
971 if [[ "$#" -ne 1 ]]; then
972 die "${FUNCNAME}() requires 1 argument"
973 fi
974
975 if [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+$ ]]; then
976 echo "CPython"
977 elif [[ "$1" =~ ^[[:digit:]]+\.[[:digit:]]+-jython$ ]]; then
978 echo "Jython"
979 else
980 die "${FUNCNAME}(): Unrecognized Python ABI '$1'"
981 fi
982}
983
944# @FUNCTION: PYTHON 984# @FUNCTION: PYTHON
945# @USAGE: [-2] [-3] [--ABI] [-A|--active] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}"> 985# @USAGE: [-2] [-3] [--ABI] [-A|--active] [-a|--absolute-path] [-f|--final-ABI] [--] <Python_ABI="${PYTHON_ABI}">
946# @DESCRIPTION: 986# @DESCRIPTION:
947# Print Python interpreter filename for specified Python ABI. If Python_ABI argument 987# Print filename of Python interpreter for specified Python ABI. If Python_ABI argument
948# is ommitted, then PYTHON_ABI environment variable must be set and is used. 988# is ommitted, then PYTHON_ABI environment variable must be set and is used.
949# If -2 option is specified, then active version of Python 2 is used. 989# If -2 option is specified, then active version of Python 2 is used.
950# If -3 option is specified, then active version of Python 3 is used. 990# If -3 option is specified, then active version of Python 3 is used.
951# If --active option is specified, then active version of Python is used. 991# If --active option is specified, then active version of Python is used.
952# Active version of Python can be set by python_set_active_version(). 992# Active version of Python can be set by python_set_active_version().
953# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 993# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
954# -2, -3, --active and --final-ABI options and Python_ABI argument cannot be specified simultaneously. 994# -2, -3, --active and --final-ABI options and Python_ABI argument cannot be specified simultaneously.
955# If --ABI option is specified, then only specified Python ABI is printed instead of 995# If --ABI option is specified, then only specified Python ABI is printed instead of
956# Python interpreter filename. 996# filename of Python interpreter.
997# If --absolute-path option is specified, then absolute path to Python interpreter is printed.
957# --ABI and --absolute-path options cannot be specified simultaneously. 998# --ABI and --absolute-path options cannot be specified simultaneously.
958PYTHON() { 999PYTHON() {
959 local ABI_output="0" absolute_path_output="0" active="0" final_ABI="0" python2="0" python3="0" slot= 1000 local ABI_output="0" absolute_path_output="0" active="0" final_ABI="0" PYTHON_ABI="${PYTHON_ABI}" python_interpreter python2="0" python3="0"
960 1001
961 while (($#)); do 1002 while (($#)); do
962 case "$1" in 1003 case "$1" in
963 -2) 1004 -2)
964 python2="1" 1005 python2="1"
1003 if [[ "$#" -eq 0 ]]; then 1044 if [[ "$#" -eq 0 ]]; then
1004 if [[ "${active}" == "1" ]]; then 1045 if [[ "${active}" == "1" ]]; then
1005 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 1046 if [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
1006 die "${FUNCNAME}(): '--active' option cannot be used in ebuilds of packages supporting installation for multiple versions of Python" 1047 die "${FUNCNAME}(): '--active' option cannot be used in ebuilds of packages supporting installation for multiple versions of Python"
1007 fi 1048 fi
1008 slot="$("${EPREFIX}/usr/bin/python" -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" 1049 PYTHON_ABI="$("${EPREFIX}/usr/bin/python" -c "${_PYTHON_ABI_EXTRACTION_COMMAND}")"
1009 elif [[ "${final_ABI}" == "1" ]]; then 1050 elif [[ "${final_ABI}" == "1" ]]; then
1010 if has "${EAPI:-0}" 0 1 2 3 4 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then 1051 if has "${EAPI:-0}" 0 1 2 3 4 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
1011 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python" 1052 die "${FUNCNAME}(): '--final-ABI' option cannot be used in ebuilds of packages not supporting installation for multiple versions of Python"
1012 fi 1053 fi
1013 validate_PYTHON_ABIS 1054 validate_PYTHON_ABIS
1014 slot="${PYTHON_ABIS##* }" 1055 PYTHON_ABI="${PYTHON_ABIS##* }"
1015 elif [[ "${python2}" == "1" ]]; then 1056 elif [[ "${python2}" == "1" ]]; then
1057 # PYTHON_ABI="$(eselect python show --python2 --ABI)"
1016 slot="$(eselect python show --python2)" 1058 PYTHON_ABI="$(eselect python show --python2)"
1017 if [[ -z "${slot}" ]]; then 1059 if [[ -z "${PYTHON_ABI}" ]]; then
1018 die "${FUNCNAME}(): Active Python 2 interpreter not set" 1060 die "${FUNCNAME}(): Active Python 2 interpreter not set"
1019 elif [[ "${slot}" != "python2."* ]]; then 1061 elif [[ "${PYTHON_ABI}" != "python2."* ]]; then
1020 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`" 1062 die "${FUNCNAME}(): Internal error in \`eselect python show --python2\`"
1021 fi 1063 fi
1022 slot="${slot#python}" 1064 PYTHON_ABI="${PYTHON_ABI#python}"
1023 elif [[ "${python3}" == "1" ]]; then 1065 elif [[ "${python3}" == "1" ]]; then
1066 # PYTHON_ABI="$(eselect python show --python3 --ABI)"
1024 slot="$(eselect python show --python3)" 1067 PYTHON_ABI="$(eselect python show --python3)"
1025 if [[ -z "${slot}" ]]; then 1068 if [[ -z "${PYTHON_ABI}" ]]; then
1026 die "${FUNCNAME}(): Active Python 3 interpreter not set" 1069 die "${FUNCNAME}(): Active Python 3 interpreter not set"
1027 elif [[ "${slot}" != "python3."* ]]; then 1070 elif [[ "${PYTHON_ABI}" != "python3."* ]]; then
1028 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`" 1071 die "${FUNCNAME}(): Internal error in \`eselect python show --python3\`"
1029 fi 1072 fi
1030 slot="${slot#python}" 1073 PYTHON_ABI="${PYTHON_ABI#python}"
1031 elif [[ -n "${PYTHON_ABI}" ]]; then 1074 elif [[ -z "${PYTHON_ABI}" ]]; then
1032 slot="${PYTHON_ABI}" 1075 die "${FUNCNAME}(): Invalid usage: Python ABI not specified"
1033 else
1034 die "${FUNCNAME}(): Invalid usage"
1035 fi 1076 fi
1036 elif [[ "$#" -eq 1 ]]; then 1077 elif [[ "$#" -eq 1 ]]; then
1037 if [[ "${active}" == "1" ]]; then 1078 if [[ "${active}" == "1" ]]; then
1038 die "${FUNCNAME}(): '--active' option and Python ABI cannot be specified simultaneously" 1079 die "${FUNCNAME}(): '--active' option and Python ABI cannot be specified simultaneously"
1039 fi 1080 fi
1044 die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously" 1085 die "${FUNCNAME}(): '-2' option and Python ABI cannot be specified simultaneously"
1045 fi 1086 fi
1046 if [[ "${python3}" == "1" ]]; then 1087 if [[ "${python3}" == "1" ]]; then
1047 die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously" 1088 die "${FUNCNAME}(): '-3' option and Python ABI cannot be specified simultaneously"
1048 fi 1089 fi
1049 slot="$1" 1090 PYTHON_ABI="$1"
1050 else 1091 else
1051 die "${FUNCNAME}(): Invalid usage" 1092 die "${FUNCNAME}(): Invalid usage"
1052 fi 1093 fi
1053 1094
1054 if [[ "${ABI_output}" == "1" ]]; then 1095 if [[ "${ABI_output}" == "1" ]]; then
1055 echo -n "${slot}" 1096 echo -n "${PYTHON_ABI}"
1056 return 1097 return
1057 elif [[ "${absolute_path_output}" == "1" ]]; then
1058 echo -n "${EPREFIX}/usr/bin/python${slot}"
1059 else 1098 else
1060 echo -n "python${slot}" 1099 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
1100 python_interpreter="python${PYTHON_ABI}"
1101 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
1102 python_interpreter="jython-${PYTHON_ABI%-jython}"
1103 fi
1104
1105 if [[ "${absolute_path_output}" == "1" ]]; then
1106 echo -n "${EPREFIX}/usr/bin/${python_interpreter}"
1107 else
1108 echo -n "${python_interpreter}"
1109 fi
1061 fi 1110 fi
1062 1111
1063 if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then 1112 if [[ -n "${ABI}" && "${ABI}" != "${DEFAULT_ABI}" && "${DEFAULT_ABI}" != "default" ]]; then
1064 echo -n "-${ABI}" 1113 echo -n "-${ABI}"
1065 fi 1114 fi
1066} 1115}
1067 1116
1068# @FUNCTION: python_get_includedir 1117# @FUNCTION: python_get_implementation
1069# @USAGE: [-f|--final-ABI] 1118# @USAGE: [-f|--final-ABI]
1070# @DESCRIPTION: 1119# @DESCRIPTION:
1071# Print path to Python include directory. 1120# Print name of Python implementation.
1072# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 1121# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
1073python_get_includedir() { 1122python_get_implementation() {
1074 local final_ABI="0" 1123 local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
1075 1124
1076 while (($#)); do 1125 while (($#)); do
1077 case "$1" in 1126 case "$1" in
1078 -f|--final-ABI) 1127 -f|--final-ABI)
1079 final_ABI="1" 1128 final_ABI="1"
1087 esac 1136 esac
1088 shift 1137 shift
1089 done 1138 done
1090 1139
1091 if [[ "${final_ABI}" == "1" ]]; then 1140 if [[ "${final_ABI}" == "1" ]]; then
1092 echo "/usr/include/python$(PYTHON -f --ABI)" 1141 PYTHON_ABI="$(PYTHON -f --ABI)"
1093 elif [[ -n "${PYTHON_ABI}" ]]; then 1142 elif [[ -z "${PYTHON_ABI}" ]]; then
1094 echo "/usr/include/python${PYTHON_ABI}" 1143 PYTHON_ABI="$(PYTHON -A --ABI)"
1095 else
1096 echo "/usr/include/python$(PYTHON -A --ABI)"
1097 fi 1144 fi
1098}
1099 1145
1100# @FUNCTION: python_get_libdir 1146 echo "$(_python_get_implementation "${PYTHON_ABI}")"
1147}
1148
1149# @FUNCTION: python_get_implementational_package
1101# @USAGE: [-f|--final-ABI] 1150# @USAGE: [-f|--final-ABI]
1102# @DESCRIPTION: 1151# @DESCRIPTION:
1103# Print path to Python library directory. 1152# Print category, name and slot of package providing Python implementation.
1104# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 1153# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
1105python_get_libdir() { 1154python_get_implementational_package() {
1106 local final_ABI="0" 1155 local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
1107 1156
1108 while (($#)); do 1157 while (($#)); do
1109 case "$1" in 1158 case "$1" in
1110 -f|--final-ABI) 1159 -f|--final-ABI)
1111 final_ABI="1" 1160 final_ABI="1"
1119 esac 1168 esac
1120 shift 1169 shift
1121 done 1170 done
1122 1171
1123 if [[ "${final_ABI}" == "1" ]]; then 1172 if [[ "${final_ABI}" == "1" ]]; then
1124 echo "/usr/$(get_libdir)/python$(PYTHON -f --ABI)" 1173 PYTHON_ABI="$(PYTHON -f --ABI)"
1125 elif [[ -n "${PYTHON_ABI}" ]]; then 1174 elif [[ -z "${PYTHON_ABI}" ]]; then
1175 PYTHON_ABI="$(PYTHON -A --ABI)"
1176 fi
1177
1178 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
1179 echo "dev-lang/python:${PYTHON_ABI}"
1180 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
1181 echo "dev-java/jython:${PYTHON_ABI%-jython}"
1182 fi
1183}
1184
1185# @FUNCTION: python_get_includedir
1186# @USAGE: [-f|--final-ABI]
1187# @DESCRIPTION:
1188# Print path to Python include directory.
1189# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
1190python_get_includedir() {
1191 local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
1192
1193 while (($#)); do
1194 case "$1" in
1195 -f|--final-ABI)
1196 final_ABI="1"
1197 ;;
1198 -*)
1199 die "${FUNCNAME}(): Unrecognized option '$1'"
1200 ;;
1201 *)
1202 die "${FUNCNAME}(): Invalid usage"
1203 ;;
1204 esac
1205 shift
1206 done
1207
1208 if [[ "${final_ABI}" == "1" ]]; then
1209 PYTHON_ABI="$(PYTHON -f --ABI)"
1210 elif [[ -z "${PYTHON_ABI}" ]]; then
1211 PYTHON_ABI="$(PYTHON -A --ABI)"
1212 fi
1213
1214 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
1215 echo "/usr/include/python${PYTHON_ABI}"
1216 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
1217 echo "/usr/share/jython-${PYTHON_ABI%-jython}/Include"
1218 fi
1219}
1220
1221# @FUNCTION: python_get_libdir
1222# @USAGE: [-f|--final-ABI]
1223# @DESCRIPTION:
1224# Print path to Python library directory.
1225# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
1226python_get_libdir() {
1227 local final_ABI="0" PYTHON_ABI="${PYTHON_ABI}"
1228
1229 while (($#)); do
1230 case "$1" in
1231 -f|--final-ABI)
1232 final_ABI="1"
1233 ;;
1234 -*)
1235 die "${FUNCNAME}(): Unrecognized option '$1'"
1236 ;;
1237 *)
1238 die "${FUNCNAME}(): Invalid usage"
1239 ;;
1240 esac
1241 shift
1242 done
1243
1244 if [[ "${final_ABI}" == "1" ]]; then
1245 PYTHON_ABI="$(PYTHON -f --ABI)"
1246 elif [[ -z "${PYTHON_ABI}" ]]; then
1247 PYTHON_ABI="$(PYTHON -A --ABI)"
1248 fi
1249
1250 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
1126 echo "/usr/$(get_libdir)/python${PYTHON_ABI}" 1251 echo "/usr/$(get_libdir)/python${PYTHON_ABI}"
1127 else 1252 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
1128 echo "/usr/$(get_libdir)/python$(PYTHON -A --ABI)" 1253 echo "/usr/share/jython-${PYTHON_ABI%-jython}/Lib"
1129 fi 1254 fi
1130} 1255}
1131 1256
1132# @FUNCTION: python_get_sitedir 1257# @FUNCTION: python_get_sitedir
1133# @USAGE: [-f|--final-ABI] 1258# @USAGE: [-f|--final-ABI]
1160# @DESCRIPTION: 1285# @DESCRIPTION:
1161# Print path to Python library. 1286# Print path to Python library.
1162# If --linker-option is specified, then "-l${library}" linker option is printed. 1287# If --linker-option is specified, then "-l${library}" linker option is printed.
1163# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used. 1288# If --final-ABI option is specified, then final ABI from the list of enabled ABIs is used.
1164python_get_library() { 1289python_get_library() {
1165 local final_ABI="0" linker_option="0" python_version 1290 local final_ABI="0" linker_option="0" PYTHON_ABI="${PYTHON_ABI}"
1166 1291
1167 while (($#)); do 1292 while (($#)); do
1168 case "$1" in 1293 case "$1" in
1169 -f|--final-ABI) 1294 -f|--final-ABI)
1170 final_ABI="1" 1295 final_ABI="1"
1181 esac 1306 esac
1182 shift 1307 shift
1183 done 1308 done
1184 1309
1185 if [[ "${final_ABI}" == "1" ]]; then 1310 if [[ "${final_ABI}" == "1" ]]; then
1186 python_version="$(PYTHON -f --ABI)" 1311 PYTHON_ABI="$(PYTHON -f --ABI)"
1187 elif [[ -n "${PYTHON_ABI}" ]]; then 1312 elif [[ -z "${PYTHON_ABI}" ]]; then
1188 python_version="${PYTHON_ABI}" 1313 PYTHON_ABI="$(PYTHON -A --ABI)"
1189 else
1190 python_version="$(PYTHON -A --ABI)"
1191 fi 1314 fi
1192 1315
1316 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
1193 if [[ "${linker_option}" == "1" ]]; then 1317 if [[ "${linker_option}" == "1" ]]; then
1194 echo "-lpython${python_version}" 1318 echo "-lpython${PYTHON_ABI}"
1195 else 1319 else
1196 echo "/usr/$(get_libdir)/libpython${python_version}$(get_libname)" 1320 echo "/usr/$(get_libdir)/libpython${PYTHON_ABI}$(get_libname)"
1321 fi
1322 elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
1323 die "${FUNCNAME}(): Jython does not have shared library"
1197 fi 1324 fi
1198} 1325}
1199 1326
1200# @FUNCTION: python_get_version 1327# @FUNCTION: python_get_version
1201# @USAGE: [-f|--final-ABI] [--major] [--minor] [--micro] 1328# @USAGE: [-f|--final-ABI] [--major] [--minor] [--micro]
1240 elif [[ "${minor}" == "1" ]]; then 1367 elif [[ "${minor}" == "1" ]]; then
1241 python_command="from sys import version_info; print(version_info[1])" 1368 python_command="from sys import version_info; print(version_info[1])"
1242 elif [[ "${micro}" == "1" ]]; then 1369 elif [[ "${micro}" == "1" ]]; then
1243 python_command="from sys import version_info; print(version_info[2])" 1370 python_command="from sys import version_info; print(version_info[2])"
1244 else 1371 else
1245 python_command="from sys import version_info; print('.'.join([str(x) for x in version_info[:2]]))" 1372 python_command="from sys import version_info; print('.'.join(str(x) for x in version_info[:2]))"
1246 fi 1373 fi
1247 1374
1248 if [[ "${final_ABI}" == "1" ]]; then 1375 if [[ "${final_ABI}" == "1" ]]; then
1249 "$(PYTHON -f)" -c "${python_command}" 1376 "$(PYTHON -f)" -c "${python_command}"
1250 else 1377 else
1256# =================================== MISCELLANEOUS FUNCTIONS ==================================== 1383# =================================== MISCELLANEOUS FUNCTIONS ====================================
1257# ================================================================================================ 1384# ================================================================================================
1258 1385
1259_python_implementation() { 1386_python_implementation() {
1260 if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then 1387 if [[ "${CATEGORY}/${PN}" == "dev-lang/python" ]]; then
1388 return 0
1389 elif [[ "${CATEGORY}/${PN}" == "dev-java/jython" ]]; then
1261 return 0 1390 return 0
1262 else 1391 else
1263 return 1 1392 return 1
1264 fi 1393 fi
1265} 1394}
1450 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 1579 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
1451 else 1580 else
1452 if [[ -n "${separate_build_dirs}" ]]; then 1581 if [[ -n "${separate_build_dirs}" ]]; then
1453 die "${FUNCNAME}(): Invalid usage" 1582 die "${FUNCNAME}(): Invalid usage"
1454 fi 1583 fi
1455 python_test_function "$@" 1584 python_test_function "$@" || die "Testing failed"
1456 fi 1585 fi
1586
1587 unset -f python_test_function
1457} 1588}
1458 1589
1459# @FUNCTION: python_execute_py.test 1590# @FUNCTION: python_execute_py.test
1460# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] 1591# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
1461# @DESCRIPTION: 1592# @DESCRIPTION:
1508 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 1639 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
1509 else 1640 else
1510 if [[ -n "${separate_build_dirs}" ]]; then 1641 if [[ -n "${separate_build_dirs}" ]]; then
1511 die "${FUNCNAME}(): Invalid usage" 1642 die "${FUNCNAME}(): Invalid usage"
1512 fi 1643 fi
1513 python_test_function "$@" 1644 python_test_function "$@" || die "Testing failed"
1514 fi 1645 fi
1646
1647 unset -f python_test_function
1515} 1648}
1516 1649
1517# @FUNCTION: python_execute_trial 1650# @FUNCTION: python_execute_trial
1518# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] 1651# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
1519# @DESCRIPTION: 1652# @DESCRIPTION:
1566 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 1699 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
1567 else 1700 else
1568 if [[ -n "${separate_build_dirs}" ]]; then 1701 if [[ -n "${separate_build_dirs}" ]]; then
1569 die "${FUNCNAME}(): Invalid usage" 1702 die "${FUNCNAME}(): Invalid usage"
1570 fi 1703 fi
1571 python_test_function "$@" 1704 python_test_function "$@" || die "Testing failed"
1572 fi 1705 fi
1706
1707 unset -f python_test_function
1573} 1708}
1574 1709
1575# ================================================================================================ 1710# ================================================================================================
1576# ======================= FUNCTIONS FOR HANDLING OF BYTE-COMPILED MODULES ======================== 1711# ======================= FUNCTIONS FOR HANDLING OF BYTE-COMPILED MODULES ========================
1577# ================================================================================================ 1712# ================================================================================================
1669 options+=("-q") 1804 options+=("-q")
1670 1805
1671 for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI-$(PYTHON -A --ABI)}}; do 1806 for PYTHON_ABI in ${PYTHON_ABIS-${PYTHON_ABI-$(PYTHON -A --ABI)}}; do
1672 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then 1807 if ((${#site_packages_dirs[@]})) || ((${#site_packages_files[@]})); then
1673 return_code="0" 1808 return_code="0"
1674 ebegin "Compilation and optimization of Python modules for Python ${PYTHON_ABI}" 1809 ebegin "Compilation and optimization of Python modules for $(python_get_implementation) $(python_get_version)"
1675 if ((${#site_packages_dirs[@]})); then 1810 if ((${#site_packages_dirs[@]})); then
1676 for dir in "${site_packages_dirs[@]}"; do 1811 for dir in "${site_packages_dirs[@]}"; do
1677 site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}") 1812 site_packages_absolute_dirs+=("${root}$(python_get_sitedir)/${dir}")
1678 done 1813 done
1679 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1" 1814 "$(PYTHON)" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" || return_code="1"
1815 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
1680 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &> /dev/null || return_code="1" 1816 "$(PYTHON)" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${site_packages_absolute_dirs[@]}" &> /dev/null || return_code="1"
1817 fi
1681 fi 1818 fi
1682 if ((${#site_packages_files[@]})); then 1819 if ((${#site_packages_files[@]})); then
1683 for file in "${site_packages_files[@]}"; do 1820 for file in "${site_packages_files[@]}"; do
1684 site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}") 1821 site_packages_absolute_files+=("${root}$(python_get_sitedir)/${file}")
1685 done 1822 done
1686 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1" 1823 "$(PYTHON)" "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" || return_code="1"
1824 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
1687 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &> /dev/null || return_code="1" 1825 "$(PYTHON)" -O "${root}$(python_get_libdir)/py_compile.py" "${site_packages_absolute_files[@]}" &> /dev/null || return_code="1"
1826 fi
1688 fi 1827 fi
1689 eend "${return_code}" 1828 eend "${return_code}"
1690 fi 1829 fi
1691 unset site_packages_absolute_dirs site_packages_absolute_files 1830 unset site_packages_absolute_dirs site_packages_absolute_files
1692 done 1831 done
1701 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then 1840 if ((${#other_dirs[@]})) || ((${#other_files[@]})); then
1702 return_code="0" 1841 return_code="0"
1703 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python $(PYTHON -A --ABI)" 1842 ebegin "Compilation and optimization of Python modules placed outside of site-packages directories for Python $(PYTHON -A --ABI)"
1704 if ((${#other_dirs[@]})); then 1843 if ((${#other_dirs[@]})); then
1705 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1" 1844 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" || return_code="1"
1845 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
1706 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1" 1846 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/compileall.py" "${options[@]}" "${other_dirs[@]}" &> /dev/null || return_code="1"
1847 fi
1707 fi 1848 fi
1708 if ((${#other_files[@]})); then 1849 if ((${#other_files[@]})); then
1709 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1" 1850 "$(PYTHON "${PYTHON_ABI--A}")" "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" || return_code="1"
1851 if [[ "$(_python_get_implementation "${PYTHON_ABI}")" != "Jython" ]]; then
1710 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1" 1852 "$(PYTHON "${PYTHON_ABI--A}")" -O "${root}$(python_get_libdir)/py_compile.py" "${other_files[@]}" &> /dev/null || return_code="1"
1853 fi
1711 fi 1854 fi
1712 eend "${return_code}" 1855 eend "${return_code}"
1713 fi 1856 fi
1714 else 1857 else
1715 local myroot mydirs=() myfiles=() myopts=() return_code="0" 1858 local myroot mydirs=() myfiles=() myopts=() return_code="0"
1812 SEARCH_PATH+=("${sitedir}") 1955 SEARCH_PATH+=("${sitedir}")
1813 fi 1956 fi
1814 done 1957 done
1815 fi 1958 fi
1816 done 1959 done
1960 for sitedir in "${root}"/usr/share/jython-*/Lib/site-packages; do
1961 if [[ -d "${sitedir}" ]]; then
1962 SEARCH_PATH+=("${sitedir}")
1963 fi
1964 done
1817 fi 1965 fi
1818 1966
1819 local BLUE CYAN NORMAL 1967 local BLUE CYAN NORMAL
1820 if [[ "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then 1968 if [[ "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then
1821 BLUE=$'\e[1;34m' 1969 BLUE=$'\e[1;34m'
1827 NORMAL= 1975 NORMAL=
1828 fi 1976 fi
1829 1977
1830 for path in "${SEARCH_PATH[@]}"; do 1978 for path in "${SEARCH_PATH[@]}"; do
1831 if [[ -d "${path}" ]]; then 1979 if [[ -d "${path}" ]]; then
1832 find "${path}" -name '*.py[co]' -print0 | while read -rd ''; do 1980 find "${path}" "(" -name "*.py[co]" -o -name "*\$py.class" ")" -print0 | while read -rd ''; do
1981 if [[ "${REPLY}" == *[co] ]]; then
1833 py_file="${REPLY%[co]}" 1982 py_file="${REPLY%[co]}"
1834 [[ -f "${py_file}" || (! -f "${py_file}c" && ! -f "${py_file}o") ]] && continue 1983 [[ -f "${py_file}" || (! -f "${py_file}c" && ! -f "${py_file}o") ]] && continue
1835 einfo "${BLUE}<<< ${py_file}[co]${NORMAL}" 1984 einfo "${BLUE}<<< ${py_file}[co]${NORMAL}"
1836 rm -f "${py_file}"[co] 1985 rm -f "${py_file}"[co]
1986 elif [[ "${REPLY}" == *\$py.class ]]; then
1987 py_file="${REPLY%\$py.class}.py"
1988 [[ -f "${py_file}" || ! -f "${py_file%.py}\$py.class" ]] && continue
1989 einfo "${BLUE}<<< ${py_file%.py}\$py.class${NORMAL}"
1990 rm -f "${py_file%.py}\$py.class"
1991 fi
1837 done 1992 done
1838 1993
1839 # Attempt to delete directories, which may be empty. 1994 # Attempt to delete directories, which may be empty.
1840 find "${path}" -type d | sort -r | while read -r dir; do 1995 find "${path}" -type d | sort -r | while read -r dir; do
1841 rmdir "${dir}" 2>/dev/null && einfo "${CYAN}<<< ${dir}${NORMAL}" 1996 rmdir "${dir}" 2>/dev/null && einfo "${CYAN}<<< ${dir}${NORMAL}"
1842 done 1997 done
1843 elif [[ "${path}" == *.py && ! -f "${path}" && (-f "${path}c" || -f "${path}o") ]]; then 1998 elif [[ "${path}" == *.py && ! -f "${path}" ]]; then
1999 if [[ (-f "${path}c" || -f "${path}o") ]]; then
1844 einfo "${BLUE}<<< ${path}[co]${NORMAL}" 2000 einfo "${BLUE}<<< ${path}[co]${NORMAL}"
1845 rm -f "${path}"[co] 2001 rm -f "${path}"[co]
2002 fi
2003 if [[ -f "${path%.py}\$py.class" ]]; then
2004 einfo "${BLUE}<<< ${path%.py}\$py.class${NORMAL}"
2005 rm -f "${path%.py}\$py.class"
2006 fi
1846 fi 2007 fi
1847 done 2008 done
1848} 2009}
1849 2010
1850# ================================================================================================ 2011# ================================================================================================
1855# @DESCRIPTION: 2016# @DESCRIPTION:
1856# Run without arguments and it will export the version of python 2017# Run without arguments and it will export the version of python
1857# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR 2018# currently in use as $PYVER; sets PYVER/PYVER_MAJOR/PYVER_MINOR
1858python_version() { 2019python_version() {
1859 if ! has "${EAPI:-0}" 0 1 2; then 2020 if ! has "${EAPI:-0}" 0 1 2; then
1860 eerror "Use PYTHON() and/or python_get_*() instead of python_version()." 2021 eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()."
1861 die "${FUNCNAME}() cannot be used in this EAPI" 2022 die "${FUNCNAME}() cannot be used in this EAPI"
1862 fi 2023 fi
1863 2024
1864 [[ -n "${PYVER}" ]] && return 0 2025 [[ -n "${PYVER}" ]] && return 0
1865 local tmpstr 2026 local tmpstr
1883# Example: 2044# Example:
1884# python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py 2045# python_mod_compile /usr/lib/python2.3/site-packages/pygoogle.py
1885# 2046#
1886python_mod_compile() { 2047python_mod_compile() {
1887 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 2048 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
1888 eerror "Use python_mod_optimize() instead of python_mod_compile()." 2049 eerror "Use python_mod_optimize() instead of ${FUNCNAME}()."
1889 die "${FUNCNAME}() cannot be used in this EAPI" 2050 die "${FUNCNAME}() cannot be used in this EAPI"
1890 fi 2051 fi
1891 2052
1892 _python_initialize_prefix_variables 2053 _python_initialize_prefix_variables
1893 2054

Legend:
Removed from v.1.87  
changed lines
  Added in v.1.88

  ViewVC Help
Powered by ViewVC 1.1.20