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

Diff of /eclass/python.eclass

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

Revision 1.101 Revision 1.102
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.101 2010/07/17 23:02:14 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.102 2010/07/18 20:45:50 arfrever 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
163 if ! has "${EAPI:-0}" 0 1 2; then 163 if ! has "${EAPI:-0}" 0 1 2; then
164 eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable." 164 eerror "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
165 die "NEED_PYTHON variable cannot be used in this EAPI" 165 die "NEED_PYTHON variable cannot be used in this EAPI"
166 fi 166 fi
167 167
168 if [[ "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then 168 ewarn
169 _RED=$'\e[1;31m' 169 ewarn "\"${EBUILD}\":"
170 _NORMAL=$'\e[0m'
171 else
172 _RED=
173 _NORMAL=
174 fi
175
176 echo
177 echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: NEED_PYTHON variable is deprecated and will be banned on 2010-10-01.${_NORMAL}" 170 ewarn "Deprecation Warning: NEED_PYTHON variable is deprecated and will be banned on 2010-10-01."
178 echo " ${_RED}*${_NORMAL} ${_RED}Use PYTHON_DEPEND variable instead of NEED_PYTHON variable.${_NORMAL}" 171 ewarn "Use PYTHON_DEPEND variable instead of NEED_PYTHON variable."
179 echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}" 172 ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
180 echo 173 ewarn
181 174
182 unset _BOLD _NORMAL 175 unset _BOLD _NORMAL
183 176
184 _PYTHON_ATOMS=(">=dev-lang/python-${NEED_PYTHON}") 177 _PYTHON_ATOMS=(">=dev-lang/python-${NEED_PYTHON}")
185 DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS[@]}" 178 DEPEND+="${DEPEND:+ }${_PYTHON_ATOMS[@]}"
315 done 308 done
316 fi 309 fi
317 PYTHON_SANITY_CHECKS_EXECUTED="1" 310 PYTHON_SANITY_CHECKS_EXECUTED="1"
318} 311}
319 312
313# @ECLASS-VARIABLE: PYTHON_COLORS
314# @DESCRIPTION:
315# User-configurable colored output.
316PYTHON_COLORS="${PYTHON_COLORS:-0}"
317
320_python_set_color_variables() { 318_python_set_color_variables() {
321 if [[ "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then 319 if [[ "${PYTHON_COLORS}" != "0" && "${NOCOLOR:-false}" =~ ^(false|no)$ ]]; then
322 _BOLD=$'\e[1m' 320 _BOLD=$'\e[1m'
323 _RED=$'\e[1;31m' 321 _RED=$'\e[1;31m'
324 _GREEN=$'\e[1;32m' 322 _GREEN=$'\e[1;32m'
325 _BLUE=$'\e[1;34m' 323 _BLUE=$'\e[1;34m'
326 _CYAN=$'\e[1;36m' 324 _CYAN=$'\e[1;36m'
966 failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function" 964 failure_message="${action} failed with $(python_get_implementation) $(python_get_version) in ${function}() function"
967 fi 965 fi
968 966
969 if [[ "${nonfatal}" == "1" ]]; then 967 if [[ "${nonfatal}" == "1" ]]; then
970 if [[ "${quiet}" == "0" ]]; then 968 if [[ "${quiet}" == "0" ]]; then
971 ewarn "${_RED}${failure_message}${_NORMAL}" 969 ewarn "${failure_message}"
972 fi 970 fi
973 elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then 971 elif [[ "${final_ABI}" == "0" ]] && has "${PYTHON_ABI}" ${FAILURE_TOLERANT_PYTHON_ABIS}; then
974 if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then 972 if [[ "${EBUILD_PHASE}" != "test" ]] || ! has test-fail-continue ${FEATURES}; then
975 local enabled_PYTHON_ABIS= other_PYTHON_ABI 973 local enabled_PYTHON_ABIS= other_PYTHON_ABI
976 for other_PYTHON_ABI in ${PYTHON_ABIS}; do 974 for other_PYTHON_ABI in ${PYTHON_ABIS}; do
977 [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}" 975 [[ "${other_PYTHON_ABI}" != "${PYTHON_ABI}" ]] && enabled_PYTHON_ABIS+="${enabled_PYTHON_ABIS:+ }${other_PYTHON_ABI}"
978 done 976 done
979 export PYTHON_ABIS="${enabled_PYTHON_ABIS}" 977 export PYTHON_ABIS="${enabled_PYTHON_ABIS}"
980 fi 978 fi
981 if [[ "${quiet}" == "0" ]]; then 979 if [[ "${quiet}" == "0" ]]; then
982 ewarn "${_RED}${failure_message}${_NORMAL}" 980 ewarn "${failure_message}"
983 fi 981 fi
984 if [[ -z "${PYTHON_ABIS}" ]]; then 982 if [[ -z "${PYTHON_ABIS}" ]]; then
985 die "${function}() function failed with all enabled Python ABIs" 983 die "${function}() function failed with all enabled Python ABIs"
986 fi 984 fi
987 else 985 else
2265 esac 2263 esac
2266 shift 2264 shift
2267 done 2265 done
2268 2266
2269 if [[ "$#" -eq 0 ]]; then 2267 if [[ "$#" -eq 0 ]]; then
2270 _python_set_color_variables 2268 ewarn
2271
2272 echo
2273 echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be${_NORMAL}"
2274 echo " ${_RED}*${_NORMAL} ${_RED}disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules.${_NORMAL}"
2275 echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
2276 echo
2277
2278 einfo &> /dev/null
2279 einfo "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be" &> /dev/null 2269 ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
2280 einfo "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules." &> /dev/null 2270 ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
2281 einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null 2271 ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
2282 einfo &> /dev/null 2272 ewarn
2283 fi 2273 fi
2284 2274
2285 while (($#)); do 2275 while (($#)); do
2286 if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then 2276 if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
2287 die "${FUNCNAME}(): Invalid argument '$1'" 2277 die "${FUNCNAME}(): Invalid argument '$1'"
2409 esac 2399 esac
2410 shift 2400 shift
2411 done 2401 done
2412 2402
2413 if [[ "$#" -eq 0 ]]; then 2403 if [[ "$#" -eq 0 ]]; then
2414 _python_set_color_variables 2404 ewarn
2415
2416 echo
2417 echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be${_NORMAL}"
2418 echo " ${_RED}*${_NORMAL} ${_RED}disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules.${_NORMAL}"
2419 echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
2420 echo
2421
2422 einfo &> /dev/null
2423 einfo "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be" &> /dev/null 2405 ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
2424 einfo "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules." &> /dev/null 2406 ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
2425 einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null 2407 ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
2426 einfo &> /dev/null 2408 ewarn
2427 fi 2409 fi
2428 2410
2429 while (($#)); do 2411 while (($#)); do
2430 if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then 2412 if [[ "$1" =~ ^($|(\.|\.\.|/)($|/)) ]]; then
2431 die "${FUNCNAME}(): Invalid argument '$1'" 2413 die "${FUNCNAME}(): Invalid argument '$1'"
2522 2504
2523 search_paths=("${@#/}") 2505 search_paths=("${@#/}")
2524 search_paths=("${search_paths[@]/#/${root}/}") 2506 search_paths=("${search_paths[@]/#/${root}/}")
2525 fi 2507 fi
2526 else 2508 else
2527 _python_set_color_variables 2509 ewarn
2528
2529 echo
2530 echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be${_NORMAL}"
2531 echo " ${_RED}*${_NORMAL} ${_RED}disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules.${_NORMAL}"
2532 echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
2533 echo
2534
2535 einfo &> /dev/null
2536 einfo "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be" &> /dev/null 2510 ewarn "Deprecation Warning: Not passing of paths to ${FUNCNAME}() is deprecated and will be"
2537 einfo "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules." &> /dev/null 2511 ewarn "disallowed on 2010-09-01. Call ${FUNCNAME}() with paths to Python modules."
2538 einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null 2512 ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
2539 einfo &> /dev/null 2513 ewarn
2540 2514
2541 for dir in "${root}"/usr/lib*; do 2515 for dir in "${root}"/usr/lib*; do
2542 if [[ -d "${dir}" && ! -L "${dir}" ]]; then 2516 if [[ -d "${dir}" && ! -L "${dir}" ]]; then
2543 for sitedir in "${dir}"/python*/site-packages; do 2517 for sitedir in "${dir}"/python*/site-packages; do
2544 if [[ -d "${sitedir}" ]]; then 2518 if [[ -d "${sitedir}" ]]; then
2596 2570
2597 _python_initialize_prefix_variables 2571 _python_initialize_prefix_variables
2598 _python_set_color_variables 2572 _python_set_color_variables
2599 2573
2600 if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then 2574 if [[ "${FUNCNAME[1]}" != "python_mod_optimize" ]]; then
2601 echo 2575 ewarn
2602 echo " ${_RED}*${_NORMAL} ${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01.${_NORMAL}"
2603 echo " ${_RED}*${_NORMAL} ${_RED}Use python_mod_optimize() instead of ${FUNCNAME}().${_NORMAL}"
2604 echo " ${_RED}*${_NORMAL} ${_RED}The ebuild needs to be fixed. Please report a bug, if it has not been already reported.${_NORMAL}"
2605 echo
2606
2607 einfo &> /dev/null
2608 einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01." &> /dev/null 2576 ewarn "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-09-01."
2609 einfo "Use python_mod_optimize() instead of ${FUNCNAME}()." &> /dev/null 2577 ewarn "Use python_mod_optimize() instead of ${FUNCNAME}()."
2610 einfo "The ebuild needs to be fixed. Please report a bug, if it has not been already reported." &> /dev/null 2578 ewarn "The ebuild needs to be fixed. Please report a bug, if it has not been already reported."
2611 einfo &> /dev/null 2579 ewarn
2612 fi 2580 fi
2613 2581
2614 local f myroot myfiles=() 2582 local f myroot myfiles=()
2615 2583
2616 # Check if phase is pkg_postinst() 2584 # Check if phase is pkg_postinst()

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102

  ViewVC Help
Powered by ViewVC 1.1.20