| 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/distutils.eclass,v 1.68 2009/12/24 04:21:39 arfrever Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.69 2010/01/10 17:24:32 arfrever Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: distutils.eclass |
5 | # @ECLASS: distutils.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # <python@gentoo.org> |
7 | # <python@gentoo.org> |
| 8 | # |
8 | # |
| … | |
… | |
| 137 | _distutils_hook post |
137 | _distutils_hook post |
| 138 | } |
138 | } |
| 139 | python_execute_function building "$@" |
139 | python_execute_function building "$@" |
| 140 | fi |
140 | fi |
| 141 | else |
141 | else |
| 142 | python_version |
|
|
| 143 | echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" |
142 | echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" |
| 144 | "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" |
143 | "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" |
| 145 | fi |
144 | fi |
| 146 | } |
145 | } |
| 147 | |
146 | |
| 148 | # @FUNCTION: distutils_src_install |
147 | # @FUNCTION: distutils_src_install |
| 149 | # @DESCRIPTION: |
148 | # @DESCRIPTION: |
| … | |
… | |
| 157 | die "${FUNCNAME}() can be used only in src_install() phase" |
156 | die "${FUNCNAME}() can be used only in src_install() phase" |
| 158 | fi |
157 | fi |
| 159 | |
158 | |
| 160 | local pylibdir |
159 | local pylibdir |
| 161 | |
160 | |
| 162 | # Mark the package to be rebuilt after a python upgrade. |
|
|
| 163 | python_need_rebuild |
|
|
| 164 | |
|
|
| 165 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
161 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
| 166 | if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge "4" ]]; then |
162 | if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${BASH_VERSINFO[0]}" -ge "4" ]]; then |
| 167 | declare -A wrapper_scripts=() |
163 | declare -A wrapper_scripts=() |
| 168 | |
164 | |
| 169 | rename_scripts_with_versioned_shebangs() { |
165 | rename_scripts_with_versioned_shebangs() { |
| … | |
… | |
| 228 | if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${#wrapper_scripts[@]}" -ne "0" && "${BASH_VERSINFO[0]}" -ge "4" ]]; then |
224 | if [[ -z "${DISTUTILS_DISABLE_VERSIONING_OF_PYTHON_SCRIPTS}" && "${#wrapper_scripts[@]}" -ne "0" && "${BASH_VERSINFO[0]}" -ge "4" ]]; then |
| 229 | python_generate_wrapper_scripts "${!wrapper_scripts[@]}" |
225 | python_generate_wrapper_scripts "${!wrapper_scripts[@]}" |
| 230 | fi |
226 | fi |
| 231 | unset wrapper_scripts |
227 | unset wrapper_scripts |
| 232 | else |
228 | else |
|
|
229 | # Mark the package to be rebuilt after a Python upgrade. |
|
|
230 | python_need_rebuild |
|
|
231 | |
| 233 | # need this for python-2.5 + setuptools in cases where |
232 | # need this for python-2.5 + setuptools in cases where |
| 234 | # a package uses distutils but does not install anything |
233 | # a package uses distutils but does not install anything |
| 235 | # in site-packages. (eg. dev-java/java-config-2.x) |
234 | # in site-packages. (eg. dev-java/java-config-2.x) |
| 236 | # - liquidx (14/08/2006) |
235 | # - liquidx (14/08/2006) |
| 237 | pylibdir="$("$(PYTHON "${PYVER}")" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
236 | pylibdir="$("$(PYTHON -A)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
| 238 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
237 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
| 239 | |
238 | |
| 240 | echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" |
239 | echo "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" |
| 241 | "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" |
240 | "$(PYTHON -A)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" |
| 242 | fi |
241 | fi |
| 243 | |
242 | |
| 244 | if [[ -e "${D}usr/local" ]]; then |
243 | if [[ -e "${D}usr/local" ]]; then |
| 245 | die "Illegal installation into /usr/local" |
244 | die "Illegal installation into /usr/local" |
| 246 | fi |
245 | fi |
| … | |
… | |
| 320 | } |
319 | } |
| 321 | |
320 | |
| 322 | # @FUNCTION: distutils_python_version |
321 | # @FUNCTION: distutils_python_version |
| 323 | # @DESCRIPTION: |
322 | # @DESCRIPTION: |
| 324 | # Calls python_version, so that you can use something like |
323 | # Calls python_version, so that you can use something like |
| 325 | # e.g. insinto ${ROOT}/usr/include/python${PYVER} |
324 | # e.g. insinto $(python_get_includedir) |
| 326 | distutils_python_version() { |
325 | distutils_python_version() { |
| 327 | if ! has "${EAPI:-0}" 0 1 2; then |
326 | if ! has "${EAPI:-0}" 0 1 2; then |
| 328 | die "${FUNCNAME}() cannot be used in this EAPI" |
327 | die "${FUNCNAME}() cannot be used in this EAPI" |
| 329 | fi |
328 | fi |
| 330 | |
329 | |