| 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.59 2009/08/12 02:24:34 arfrever Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.60 2009/09/05 16:45:35 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 | # |
| … | |
… | |
| 22 | *) |
22 | *) |
| 23 | EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm |
23 | EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst pkg_postrm |
| 24 | ;; |
24 | ;; |
| 25 | esac |
25 | esac |
| 26 | |
26 | |
| 27 | # @ECLASS-VARIABLE: PYTHON_SLOT_VERSION |
|
|
| 28 | # @DESCRIPTION: |
|
|
| 29 | # This helps make it possible to add extensions to python slots. |
|
|
| 30 | # Normally only a -py21- ebuild would set PYTHON_SLOT_VERSION. |
|
|
| 31 | if [ "${PYTHON_SLOT_VERSION}" = "2.1" ] ; then |
|
|
| 32 | DEPEND="=dev-lang/python-2.1*" |
|
|
| 33 | python="python2.1" |
|
|
| 34 | elif [ "${PYTHON_SLOT_VERSION}" = "2.3" ] ; then |
|
|
| 35 | DEPEND="=dev-lang/python-2.3*" |
|
|
| 36 | python="python2.3" |
|
|
| 37 | else |
|
|
| 38 | DEPEND="virtual/python" |
27 | DEPEND="virtual/python" |
|
|
28 | RDEPEND="${DEPEND}" |
| 39 | python="python" |
29 | python="python" |
| 40 | fi |
30 | |
|
|
31 | # @ECLASS-VARIABLE: DISTUTILS_GLOBAL_OPTIONS |
|
|
32 | # @DESCRIPTION: |
|
|
33 | # Global options passed to setup.py. |
| 41 | |
34 | |
| 42 | # @ECLASS-VARIABLE: DOCS |
35 | # @ECLASS-VARIABLE: DOCS |
| 43 | # @DESCRIPTION: |
36 | # @DESCRIPTION: |
| 44 | # Additional DOCS |
37 | # Additional DOCS |
| 45 | |
38 | |
| … | |
… | |
| 79 | die "${FUNCNAME}() can be used only in src_compile() phase" |
72 | die "${FUNCNAME}() can be used only in src_compile() phase" |
| 80 | fi |
73 | fi |
| 81 | |
74 | |
| 82 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
75 | if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then |
| 83 | building() { |
76 | building() { |
| 84 | echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" |
77 | echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" |
| 85 | "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" "$@" |
78 | "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" |
| 86 | } |
79 | } |
| 87 | python_execute_function building "$@" |
80 | python_execute_function building "$@" |
| 88 | else |
81 | else |
| 89 | echo ${python} setup.py build "$@" |
82 | echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" |
| 90 | ${python} setup.py build "$@" || die "Building failed" |
83 | ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" |
| 91 | fi |
84 | fi |
| 92 | } |
85 | } |
| 93 | |
86 | |
| 94 | # @FUNCTION: distutils_src_install |
87 | # @FUNCTION: distutils_src_install |
| 95 | # @DESCRIPTION: |
88 | # @DESCRIPTION: |
| … | |
… | |
| 113 | # in site-packages. (eg. dev-java/java-config-2.x) |
106 | # in site-packages. (eg. dev-java/java-config-2.x) |
| 114 | # - liquidx (14/08/2006) |
107 | # - liquidx (14/08/2006) |
| 115 | pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
108 | pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
| 116 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
109 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
| 117 | |
110 | |
| 118 | echo "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" |
111 | echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" |
| 119 | "$(PYTHON)" setup.py build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" |
112 | "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" |
| 120 | } |
113 | } |
| 121 | python_execute_function installation "$@" |
114 | python_execute_function installation "$@" |
| 122 | else |
115 | else |
| 123 | # need this for python-2.5 + setuptools in cases where |
116 | # need this for python-2.5 + setuptools in cases where |
| 124 | # a package uses distutils but does not install anything |
117 | # a package uses distutils but does not install anything |
| 125 | # in site-packages. (eg. dev-java/java-config-2.x) |
118 | # in site-packages. (eg. dev-java/java-config-2.x) |
| 126 | # - liquidx (14/08/2006) |
119 | # - liquidx (14/08/2006) |
| 127 | pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
120 | pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" |
| 128 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
121 | [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" |
| 129 | |
122 | |
| 130 | echo ${python} setup.py install --root="${D}" --no-compile "$@" |
123 | echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" |
| 131 | ${python} setup.py install --root="${D}" --no-compile "$@" || die "Installation failed" |
124 | ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" |
| 132 | fi |
125 | fi |
| 133 | |
126 | |
| 134 | DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS" |
127 | DDOCS="CHANGELOG KNOWN_BUGS MAINTAINERS PKG-INFO CONTRIBUTORS TODO NEWS" |
| 135 | DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS" |
128 | DDOCS="${DDOCS} Change* MANIFEST* README* AUTHORS" |
| 136 | |
129 | |