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

Diff of /eclass/python.eclass

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

Revision 1.72 Revision 1.77
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2009 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.72 2009/09/11 19:55:05 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.77 2009/10/11 13:34:23 arfrever Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8#
9# original author: Alastair Tse <liquidx@gentoo.org>
10# @BLURB: A Utility Eclass that should be inherited by anything that deals with Python or Python modules. 8# @BLURB: A utility eclass that should be inherited by anything that deals with Python or Python modules.
11# @DESCRIPTION: 9# @DESCRIPTION:
12# Some useful functions for dealing with Python. 10# Some useful functions for dealing with Python.
13 11
14inherit multilib 12inherit multilib
15 13
16if [[ -n "${NEED_PYTHON}" ]] ; then 14if [[ -n "${NEED_PYTHON}" ]]; then
17 PYTHON_ATOM=">=dev-lang/python-${NEED_PYTHON}" 15 PYTHON_ATOM=">=dev-lang/python-${NEED_PYTHON}"
18 DEPEND="${PYTHON_ATOM}" 16 DEPEND="${PYTHON_ATOM}"
19 RDEPEND="${DEPEND}" 17 RDEPEND="${DEPEND}"
20else 18else
21 PYTHON_ATOM="dev-lang/python" 19 PYTHON_ATOM="dev-lang/python"
22fi 20fi
23 21
24DEPEND="${DEPEND} >=app-shells/bash-3.2"
25if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
26 DEPEND="${DEPEND} >=app-admin/eselect-python-20090804" 22DEPEND+=" >=app-admin/eselect-python-20090804
27fi 23 >=app-shells/bash-3.2"
28 24
29__python_eclass_test() { 25__python_eclass_test() {
30 __python_version_extract 2.3 26 __python_version_extract 2.3
31 echo -n "2.3 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR" 27 echo -n "2.3 -> PYVER: $PYVER PYVER_MAJOR: $PYVER_MAJOR"
32 echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO" 28 echo " PYVER_MINOR: $PYVER_MINOR PYVER_MICRO: $PYVER_MICRO"
110 else 106 else
111 echo -n "python${slot}" 107 echo -n "python${slot}"
112 fi 108 fi
113} 109}
114 110
111unset PYTHON_ABIS
112unset PYTHON_ABIS_SANITY_CHECKS
113
115# @FUNCTION: validate_PYTHON_ABIS 114# @FUNCTION: validate_PYTHON_ABIS
116# @DESCRIPTION: 115# @DESCRIPTION:
117# Make sure PYTHON_ABIS variable has valid value. 116# Ensure that PYTHON_ABIS variable has valid value.
118validate_PYTHON_ABIS() { 117validate_PYTHON_ABIS() {
119 # Ensure that some functions cannot be accidentally successfully used in EAPI <= 2 without setting SUPPORT_PYTHON_ABIS variable. 118 # Ensure that some functions cannot be accidentally successfully used in EAPI <= 2 without setting SUPPORT_PYTHON_ABIS variable.
120 if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then 119 if has "${EAPI:-0}" 0 1 2 && [[ -z "${SUPPORT_PYTHON_ABIS}" ]]; then
121 die "${FUNCNAME}() cannot be used in this EAPI without setting SUPPORT_PYTHON_ABIS variable" 120 die "${FUNCNAME}() cannot be used in this EAPI without setting SUPPORT_PYTHON_ABIS variable"
122 fi 121 fi
129 die "'/usr/bin/python-config' isn't valid script" 128 die "'/usr/bin/python-config' isn't valid script"
130 fi 129 fi
131 130
132 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 4. 131 # USE_${ABI_TYPE^^} and RESTRICT_${ABI_TYPE^^}_ABIS variables hopefully will be included in EAPI >= 4.
133 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3; then 132 if [[ "$(declare -p PYTHON_ABIS 2> /dev/null)" != "declare -x PYTHON_ABIS="* ]] && has "${EAPI:-0}" 0 1 2 3; then
134 local ABI support_ABI supported_PYTHON_ABIS= restricted_ABI 133 local ABI python2_supported_versions python3_supported_versions restricted_ABI support_ABI supported_PYTHON_ABIS=
135 PYTHON_ABI_SUPPORTED_VALUES="2.4 2.5 2.6 2.7 3.0 3.1 3.2" 134 PYTHON_ABI_SUPPORTED_VALUES="2.4 2.5 2.6 2.7 3.0 3.1 3.2"
135 python2_supported_versions="2.4 2.5 2.6 2.7"
136 python3_supported_versions="3.0 3.1 3.2"
136 137
137 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then 138 if [[ "$(declare -p USE_PYTHON 2> /dev/null)" == "declare -x USE_PYTHON="* ]]; then
139 local python2_enabled="0" python3_enabled="0"
140
138 if [[ -z "${USE_PYTHON}" ]]; then 141 if [[ -z "${USE_PYTHON}" ]]; then
139 die "USE_PYTHON variable is empty" 142 die "USE_PYTHON variable is empty"
140 fi 143 fi
141 144
142 for ABI in ${USE_PYTHON}; do 145 for ABI in ${USE_PYTHON}; do
143 if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then 146 if ! has "${ABI}" ${PYTHON_ABI_SUPPORTED_VALUES}; then
144 die "USE_PYTHON variable contains invalid value '${ABI}'" 147 die "USE_PYTHON variable contains invalid value '${ABI}'"
145 fi 148 fi
149
150 if has "${ABI}" ${python2_supported_versions}; then
151 python2_enabled="1"
152 fi
153 if has "${ABI}" ${python3_supported_versions}; then
154 python3_enabled="1"
155 fi
156
146 support_ABI="1" 157 support_ABI="1"
147 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do 158 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
148 if python -c "from fnmatch import fnmatch; exit(not fnmatch('${ABI}', '${restricted_ABI}'))"; then 159 if [[ "${ABI}" == ${restricted_ABI} ]]; then
149 support_ABI="0" 160 support_ABI="0"
150 break 161 break
151 fi 162 fi
152 done 163 done
153 [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}" 164 [[ "${support_ABI}" == "1" ]] && supported_PYTHON_ABIS+=" ${ABI}"
154 done 165 done
155 export PYTHON_ABIS="${supported_PYTHON_ABIS# }" 166 export PYTHON_ABIS="${supported_PYTHON_ABIS# }"
156 167
157 if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then 168 if [[ -z "${PYTHON_ABIS//[${IFS}]/}" ]]; then
158 die "USE_PYTHON variable doesn't enable any Python version supported by ${CATEGORY}/${PF}" 169 die "USE_PYTHON variable doesn't enable any version of Python supported by ${CATEGORY}/${PF}"
170 fi
171
172 if [[ "${python2_enabled}" == "0" ]]; then
173 ewarn "USE_PYTHON variable doesn't enable any version of Python 2. This configuration is unsupported."
174 fi
175 if [[ "${python3_enabled}" == "0" ]]; then
176 ewarn "USE_PYTHON variable doesn't enable any version of Python 3. This configuration is unsupported."
159 fi 177 fi
160 else 178 else
161 local restricted_ABI 179 local python_version python2_version= python3_version= support_python_major_version
162 python_version
163 180
181 python_version="$(/usr/bin/python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')"
182
183 if has_version "=dev-lang/python-2*"; then
184 if [[ "$(readlink /usr/bin/python2)" != "python2."* ]]; then
185 die "'/usr/bin/python2' isn't valid symlink"
186 fi
187
188 python2_version="$(/usr/bin/python2 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')"
189
190 for ABI in ${python2_supported_versions}; do
191 support_python_major_version="1"
164 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do 192 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
165 if python -c "from fnmatch import fnmatch; exit(not fnmatch('${PYVER}', '${restricted_ABI}'))"; then 193 if [[ "${ABI}" == ${restricted_ABI} ]]; then
166 die "Active Python version isn't supported by ${CATEGORY}/${PF}" 194 support_python_major_version="0"
167 fi 195 fi
196 done
197 [[ "${support_python_major_version}" == "1" ]] && break
168 done 198 done
169 export PYTHON_ABIS="${PYVER}" 199 if [[ "${support_python_major_version}" == "1" ]]; then
200 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
201 if [[ "${python2_version}" == ${restricted_ABI} ]]; then
202 die "Active version of Python 2 isn't supported by ${CATEGORY}/${PF}"
203 fi
204 done
205 else
206 python2_version=""
207 fi
170 fi 208 fi
209
210 if has_version "=dev-lang/python-3*"; then
211 if [[ "$(readlink /usr/bin/python3)" != "python3."* ]]; then
212 die "'/usr/bin/python3' isn't valid symlink"
213 fi
214
215 python3_version="$(/usr/bin/python3 -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')"
216
217 for ABI in ${python3_supported_versions}; do
218 support_python_major_version="1"
219 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
220 if [[ "${ABI}" == ${restricted_ABI} ]]; then
221 support_python_major_version="0"
222 fi
223 done
224 [[ "${support_python_major_version}" == "1" ]] && break
225 done
226 if [[ "${support_python_major_version}" == "1" ]]; then
227 for restricted_ABI in ${RESTRICT_PYTHON_ABIS}; do
228 if [[ "${python3_version}" == ${restricted_ABI} ]]; then
229 die "Active version of Python 3 isn't supported by ${CATEGORY}/${PF}"
230 fi
231 done
232 else
233 python3_version=""
234 fi
235 fi
236
237 if ! has "${python_version}" "${python2_version}" "${python3_version}"; then
238 eerror "Python wrapper is configured incorrectly or /usr/bin/python2 or /usr/bin/python3 symlink"
239 eerror "is set incorrectly. Use \`eselect python\` to fix configuration."
240 die "Incorrect configuration of Python"
241 fi
242
243 PYTHON_ABIS="${python2_version} ${python3_version}"
244 PYTHON_ABIS="${PYTHON_ABIS# }"
245 export PYTHON_ABIS="${PYTHON_ABIS% }"
171 fi 246 fi
247 fi
172 248
249 if [[ "$(declare -p PYTHON_ABIS_SANITY_CHECKS 2> /dev/null)" != "declare -- PYTHON_ABIS_SANITY_CHECKS="* ]]; then
173 local PYTHON_ABI 250 local PYTHON_ABI
174 for PYTHON_ABI in ${PYTHON_ABIS}; do 251 for PYTHON_ABI in ${PYTHON_ABIS}; do
175 # Ensure that appropriate Python version is installed. 252 # Ensure that appropriate Python version is installed.
176 if ! has_version "dev-lang/python:${PYTHON_ABI}"; then 253 if ! has_version "dev-lang/python:${PYTHON_ABI}"; then
177 die "dev-lang/python:${PYTHON_ABI} isn't installed" 254 die "dev-lang/python:${PYTHON_ABI} isn't installed"
178 fi 255 fi
179 256
180 # Ensure that EPYTHON variable is respected. 257 # Ensure that EPYTHON variable is respected.
181 if [[ "$(EPYTHON="$(PYTHON)" python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" != "${PYTHON_ABI}" ]]; then 258 if [[ "$(EPYTHON="$(PYTHON)" python -c 'from sys import version_info; print(".".join([str(x) for x in version_info[:2]]))')" != "${PYTHON_ABI}" ]]; then
182 die "'python' doesn't respect EPYTHON variable" 259 die "'python' doesn't respect EPYTHON variable"
183 fi 260 fi
184 done 261 done
262 PYTHON_ABIS_SANITY_CHECKS="1"
263 fi
185} 264}
186 265
187# @FUNCTION: python_copy_sources 266# @FUNCTION: python_copy_sources
188# @USAGE: [--no-link] [--] [directory] 267# @USAGE: [--no-link] [--] [directory]
189# @DESCRIPTION: 268# @DESCRIPTION:
249# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--] <function> [arguments] 328# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] [--] <function> [arguments]
250# @DESCRIPTION: 329# @DESCRIPTION:
251# Execute specified function for each value of PYTHON_ABIS, optionally passing additional 330# Execute specified function for each value of PYTHON_ABIS, optionally passing additional
252# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables. 331# arguments. The specified function can use PYTHON_ABI and BUILDDIR variables.
253python_execute_function() { 332python_execute_function() {
254 local action action_message action_message_template= default_function="0" failure_message failure_message_template= function nonfatal="0" previous_directory_stack_length PYTHON_ABI quiet="0" separate_build_dirs="0" 333 local action action_message action_message_template= default_function="0" failure_message failure_message_template= function nonfatal="0" previous_directory previous_directory_stack previous_directory_stack_length PYTHON_ABI quiet="0" separate_build_dirs="0"
255 334
256 while (($#)); do 335 while (($#)); do
257 case "$1" in 336 case "$1" in
258 --action-message) 337 --action-message)
259 action_message_template="$2" 338 action_message_template="$2"
381 pushd "${BUILDDIR}" > /dev/null || die "pushd failed" 460 pushd "${BUILDDIR}" > /dev/null || die "pushd failed"
382 else 461 else
383 export BUILDDIR="${S}" 462 export BUILDDIR="${S}"
384 fi 463 fi
385 464
386 previous_directory_stack_length="${#DIRSTACK[@]}" 465 previous_directory="$(pwd)"
466 previous_directory_stack="$(dirs -p)"
467 previous_directory_stack_length="$(dirs -p | wc -l)"
387 468
388 if ! has "${EAPI}" 0 1 2 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then 469 if ! has "${EAPI}" 0 1 2 && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
389 EPYTHON="$(PYTHON)" nonfatal "${function}" "$@" 470 EPYTHON="$(PYTHON)" nonfatal "${function}" "$@"
390 else 471 else
391 EPYTHON="$(PYTHON)" "${function}" "$@" 472 EPYTHON="$(PYTHON)" "${function}" "$@"
419 else 500 else
420 die "${failure_message}" 501 die "${failure_message}"
421 fi 502 fi
422 fi 503 fi
423 504
505 # Ensure that directory stack hasn't been decreased.
424 if [[ "${#DIRSTACK[@]}" -lt "${previous_directory_stack_length}" ]]; then 506 if [[ "$(dirs -p | wc -l)" -lt "${previous_directory_stack_length}" ]]; then
425 die "Directory stack decreased illegally" 507 die "Directory stack decreased illegally"
426 fi 508 fi
427 509
510 # Avoid side effects of earlier returning from the specified function.
428 while [[ "${#DIRSTACK[@]}" -gt "${previous_directory_stack_length}" ]]; do 511 while [[ "$(dirs -p | wc -l)" -gt "${previous_directory_stack_length}" ]]; do
429 popd > /dev/null || die "popd failed" 512 popd > /dev/null || die "popd failed"
430 done 513 done
431 514
515 # Ensure that the bottom part of directory stack hasn't been changed. Restore
516 # previous directory (from before running of the specified function) before
517 # comparison of directory stacks to avoid mismatch of directory stacks after
518 # potential using of 'cd' to change current directory. Restoration of previous
519 # directory allows to safely use 'cd' to change current directory in the
520 # specified function without changing it back to original directory.
521 cd "${previous_directory}"
522 if [[ "$(dirs -p)" != "${previous_directory_stack}" ]]; then
523 die "Directory stack changed illegally"
524 fi
525
432 if [[ "${separate_build_dirs}" == "1" ]]; then 526 if [[ "${separate_build_dirs}" == "1" ]]; then
433 popd > /dev/null || die "popd failed" 527 popd > /dev/null || die "popd failed"
434 fi 528 fi
435 unset BUILDDIR 529 unset BUILDDIR
436 done 530 done
438 if [[ "${default_function}" == "1" ]]; then 532 if [[ "${default_function}" == "1" ]]; then
439 unset -f python_default_function 533 unset -f python_default_function
440 fi 534 fi
441} 535}
442 536
537# @FUNCTION: python_convert_shebangs
538# @USAGE: [-q|--quiet] [-r|--recursive] [-x|--only-executables] [--] <Python_version> <file|directory> [files|directories]
539# @DESCRIPTION:
540# Convert shebangs in specified files. Directories can be specified only with --recursive option.
541python_convert_shebangs() {
542 local argument file files=() only_executables="0" python_version quiet="0" recursive="0"
543
544 while (($#)); do
545 case "$1" in
546 -r|--recursive)
547 recursive="1"
548 ;;
549 -q|--quiet)
550 quiet="1"
551 ;;
552 -x|--only-executables)
553 only_executables="1"
554 ;;
555 --)
556 break
557 ;;
558 -*)
559 die "${FUNCNAME}(): Unrecognized option '$1'"
560 ;;
561 *)
562 break
563 ;;
564 esac
565 shift
566 done
567
568 if [[ "$#" -eq 0 ]]; then
569 die "${FUNCNAME}(): Missing Python version and files or directories"
570 elif [[ "$#" -eq 1 ]]; then
571 die "${FUNCNAME}(): Missing files or directories"
572 fi
573
574 python_version="$1"
575 shift
576
577 for argument in "$@"; do
578 if [[ ! -e "${argument}" ]]; then
579 die "${FUNCNAME}(): '${argument}' doesn't exist"
580 elif [[ -f "${argument}" ]]; then
581 files+=("${argument}")
582 elif [[ -d "${argument}" ]]; then
583 if [[ "${recursive}" == "1" ]]; then
584 if [[ "${only_executables}" == "1" ]]; then
585 files+=($(find "${argument}" -perm /111 -type f))
586 else
587 files+=($(find "${argument}" -type f))
588 fi
589 else
590 die "${FUNCNAME}(): '${argument}' isn't a regular file"
591 fi
592 else
593 die "${FUNCNAME}(): '${argument}' isn't a regular file or a directory"
594 fi
595 done
596
597 for file in "${files[@]}"; do
598 [[ "${only_executables}" == "1" && ! -x "${file}" ]] && continue
599
600 if [[ "$(head -n1 "${file}")" =~ ^'#!'.*python ]]; then
601 [[ "${quiet}" == "0" ]] && einfo "Converting shebang in '${file}'"
602 sed -e "1s/python\([[:digit:]]\+\(\.[[:digit:]]\+\)\?\)\?/python${python_version}/" -i "${file}" || die "Conversion of shebang in '${file}' failed"
603
604 # Delete potential whitespace after "#!".
605 sed -e '1s/\(^#!\)[[:space:]]*/\1/' -i "${file}" || die "sed '${file}' failed"
606 fi
607 done
608}
443 609
444# @ECLASS-VARIABLE: PYTHON_USE_WITH 610# @ECLASS-VARIABLE: PYTHON_USE_WITH
445# @DESCRIPTION: 611# @DESCRIPTION:
446# Set this to a space separated list of use flags 612# Set this to a space separated list of use flags
447# the python slot in use must be built with. 613# the python slot in use must be built with.
460# @FUNCTION: python_pkg_setup 626# @FUNCTION: python_pkg_setup
461# @DESCRIPTION: 627# @DESCRIPTION:
462# Makes sure PYTHON_USE_WITH or PYTHON_USE_WITH_OR listed use flags 628# Makes sure PYTHON_USE_WITH or PYTHON_USE_WITH_OR listed use flags
463# are respected. Only exported if one of those variables is set. 629# are respected. Only exported if one of those variables is set.
464if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then 630if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then
631 python_pkg_setup() {
465 python_pkg_setup_fail() { 632 python_pkg_setup_fail() {
466 eerror "${1}" 633 eerror "${1}"
467 die "${1}" 634 die "${1}"
635 }
636
637 [[ ${PYTHON_USE_WITH_OPT} ]] && use !${PYTHON_USE_WITH_OPT} && return
638
639 python_pkg_setup_check_USE_flags() {
640 local pyatom use
641 if [[ -n "${PYTHON_ABI}" ]]; then
642 pyatom="dev-lang/python:${PYTHON_ABI}"
643 else
644 python_version
645 pyatom="dev-lang/python:${PYVER}"
646 fi
647
648 for use in ${PYTHON_USE_WITH}; do
649 if ! has_version "${pyatom}[${use}]"; then
650 python_pkg_setup_fail "Please rebuild ${pyatom} with the following USE flags enabled: ${PYTHON_USE_WITH}"
651 fi
652 done
653
654 for use in ${PYTHON_USE_WITH_OR}; do
655 if has_version "${pyatom}[${use}]"; then
656 return
657 fi
658 done
659
660 if [[ ${PYTHON_USE_WITH_OR} ]]; then
661 python_pkg_setup_fail "Please rebuild ${pyatom} with at least one of the following USE flags enabled: ${PYTHON_USE_WITH_OR}"
662 fi
663 }
664
665 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
666 python_execute_function -q python_pkg_setup_check_USE_flags
667 else
668 python_pkg_setup_check_USE_flags
669 fi
468 } 670 }
469 671
470 python_pkg_setup() {
471 [[ ${PYTHON_USE_WITH_OPT} ]] && use !${PYTHON_USE_WITH_OPT} && return
472
473 python_version
474 local failed
475 local pyatom="dev-lang/python:${PYVER}"
476
477 for use in ${PYTHON_USE_WITH}; do
478 if ! has_version "${pyatom}[${use}]"; then
479 python_pkg_setup_fail \
480 "Please rebuild ${pyatom} with use flags: ${PYTHON_USE_WITH}"
481 fi
482 done
483
484 for use in ${PYTHON_USE_WITH_OR}; do
485 if has_version "${pyatom}[${use}]"; then
486 return
487 fi
488 done
489
490 if [[ ${PYTHON_USE_WITH_OR} ]]; then
491 python_pkg_setup_fail \
492 "Please rebuild ${pyatom} with one of: ${PYTHON_USE_WITH_OR}"
493 fi
494 }
495
496 EXPORT_FUNCTIONS pkg_setup 672 EXPORT_FUNCTIONS pkg_setup
497 673
498 if [[ ${PYTHON_USE_WITH} ]]; then 674 if [[ -n "${PYTHON_USE_WITH}" ]]; then
499 PYTHON_USE_WITH_ATOM="${PYTHON_ATOM}[${PYTHON_USE_WITH/ /,}]" 675 PYTHON_USE_WITH_ATOM="${PYTHON_ATOM}[${PYTHON_USE_WITH/ /,}]"
500 elif [[ ${PYTHON_USE_WITH_OR} ]]; then 676 elif [[ -n "${PYTHON_USE_WITH_OR}" ]]; then
501 PYTHON_USE_WITH_ATOM="|| ( " 677 PYTHON_USE_WITH_ATOM="|| ( "
502 for use in ${PYTHON_USE_WITH_OR}; do 678 for use in ${PYTHON_USE_WITH_OR}; do
503 PYTHON_USE_WITH_ATOM=" 679 PYTHON_USE_WITH_ATOM+=" ${PYTHON_ATOM}[${use}]"
504 ${PYTHON_USE_WITH_ATOM}
505 ${PYTHON_ATOM}[${use}]"
506 done 680 done
507 PYTHON_USE_WITH_ATOM="${PYTHON_USE_WITH_ATOM} )" 681 unset use
682 PYTHON_USE_WITH_ATOM+=" )"
508 fi 683 fi
509 if [[ ${PYTHON_USE_WITH_OPT} ]]; then 684 if [[ -n "${PYTHON_USE_WITH_OPT}" ]]; then
510 PYTHON_USE_WITH_ATOM="${PYTHON_USE_WITH_OPT}? ( ${PYTHON_USE_WITH_ATOM} )" 685 PYTHON_USE_WITH_ATOM="${PYTHON_USE_WITH_OPT}? ( ${PYTHON_USE_WITH_ATOM} )"
511 fi 686 fi
512 DEPEND="${PYTHON_USE_WITH_ATOM}" 687 DEPEND+=" ${PYTHON_USE_WITH_ATOM}"
513 RDEPEND="${PYTHON_USE_WITH_ATOM}" 688 RDEPEND+=" ${PYTHON_USE_WITH_ATOM}"
514fi 689fi
515 690
516# @ECLASS-VARIABLE: PYTHON_DEFINE_DEFAULT_FUNCTIONS 691# @ECLASS-VARIABLE: PYTHON_DEFINE_DEFAULT_FUNCTIONS
517# @DESCRIPTION: 692# @DESCRIPTION:
518# Set this to define default functions for the following ebuild phases: 693# Set this to define default functions for the following ebuild phases:

Legend:
Removed from v.1.72  
changed lines
  Added in v.1.77

  ViewVC Help
Powered by ViewVC 1.1.20