| 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.92 2010/03/04 17:42:11 arfrever Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.93 2010/03/12 18:27:01 betelgeuse 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 |
| … | |
… | |
| 2023 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
2023 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
| 2024 | eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()." |
2024 | eerror "Use PYTHON() and/or python_get_*() instead of ${FUNCNAME}()." |
| 2025 | die "${FUNCNAME}() cannot be used in this EAPI" |
2025 | die "${FUNCNAME}() cannot be used in this EAPI" |
| 2026 | fi |
2026 | fi |
| 2027 | |
2027 | |
| 2028 | _python_set_color_variables |
|
|
| 2029 | |
|
|
| 2030 | if [[ "${FUNCNAME[1]}" != "distutils_python_version" ]]; then |
2028 | if [[ "${FUNCNAME[1]}" != "distutils_python_version" ]]; then |
| 2031 | eerror |
2029 | einfo |
| 2032 | eerror "${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}" |
2030 | einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." |
| 2033 | eerror "${_RED}Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables.${_NORMAL}" |
2031 | einfo "Use PYTHON() instead of python variable. Use python_get_*() instead of PYVER* variables." |
| 2034 | eerror |
2032 | einfo |
| 2035 | fi |
2033 | fi |
| 2036 | |
2034 | |
| 2037 | [[ -n "${PYVER}" ]] && return 0 |
2035 | [[ -n "${PYVER}" ]] && return 0 |
| 2038 | local tmpstr |
2036 | local tmpstr |
| 2039 | python="${python:-${EPREFIX}/usr/bin/python}" |
2037 | python="${python:-${EPREFIX}/usr/bin/python}" |
| … | |
… | |
| 2063 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
2061 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
| 2064 | eerror "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()." |
2062 | eerror "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()." |
| 2065 | die "${FUNCNAME}() cannot be used in this EAPI" |
2063 | die "${FUNCNAME}() cannot be used in this EAPI" |
| 2066 | fi |
2064 | fi |
| 2067 | |
2065 | |
| 2068 | _python_set_color_variables |
2066 | einfo |
| 2069 | |
|
|
| 2070 | eerror |
|
|
| 2071 | eerror "${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}" |
2067 | einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." |
| 2072 | eerror "${_RED}Use USE dependencies and/or has_version() instead of ${FUNCNAME}().${_NORMAL}" |
2068 | einfo "Use USE dependencies and/or has_version() instead of ${FUNCNAME}()." |
| 2073 | eerror |
2069 | einfo |
| 2074 | |
2070 | |
| 2075 | if [[ "$#" -ne 1 ]]; then |
2071 | if [[ "$#" -ne 1 ]]; then |
| 2076 | die "${FUNCNAME}() requires 1 argument" |
2072 | die "${FUNCNAME}() requires 1 argument" |
| 2077 | fi |
2073 | fi |
| 2078 | "$(PYTHON ${PYTHON_ABI})" -c "import $1" &> /dev/null |
2074 | "$(PYTHON ${PYTHON_ABI})" -c "import $1" &> /dev/null |
| … | |
… | |
| 2086 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
2082 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
| 2087 | eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." |
2083 | eerror "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." |
| 2088 | die "${FUNCNAME}() cannot be used in this EAPI" |
2084 | die "${FUNCNAME}() cannot be used in this EAPI" |
| 2089 | fi |
2085 | fi |
| 2090 | |
2086 | |
| 2091 | _python_set_color_variables |
|
|
| 2092 | |
|
|
| 2093 | if [[ "${FUNCNAME[1]}" != "distutils_python_tkinter" ]]; then |
2087 | if [[ "${FUNCNAME[1]}" != "distutils_python_tkinter" ]]; then |
| 2094 | eerror |
2088 | einfo |
| 2095 | eerror "${_RED}Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01.${_NORMAL}" |
2089 | einfo "Deprecation Warning: ${FUNCNAME}() is deprecated and will be banned on 2010-07-01." |
| 2096 | eerror "${_RED}Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}().${_NORMAL}" |
2090 | einfo "Use PYTHON_USE_WITH=\"xml\" and python_pkg_setup() instead of ${FUNCNAME}()." |
| 2097 | eerror |
2091 | einfo |
| 2098 | fi |
2092 | fi |
| 2099 | |
2093 | |
| 2100 | if ! "$(PYTHON ${PYTHON_ABI})" -c "from sys import version_info |
2094 | if ! "$(PYTHON ${PYTHON_ABI})" -c "from sys import version_info |
| 2101 | if version_info[0] == 3: |
2095 | if version_info[0] == 3: |
| 2102 | import tkinter |
2096 | import tkinter |