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

Diff of /eclass/distutils.eclass

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

Revision 1.66 Revision 1.67
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.66 2009/11/06 00:35:30 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/distutils.eclass,v 1.67 2009/11/28 18:39:27 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#
40 40
41# @ECLASS-VARIABLE: DOCS 41# @ECLASS-VARIABLE: DOCS
42# @DESCRIPTION: 42# @DESCRIPTION:
43# Additional DOCS 43# Additional DOCS
44 44
45_distutils_hook() {
46 if [[ "$#" -ne 1 ]]; then
47 die "${FUNCNAME}() requires 1 argument"
48 fi
49 if [[ "$(type -t "distutils_src_${EBUILD_PHASE}_$1_hook")" == "function" ]]; then
50 "distutils_src_${EBUILD_PHASE}_$1_hook"
51 fi
52}
53
45# @FUNCTION: distutils_src_unpack 54# @FUNCTION: distutils_src_unpack
46# @DESCRIPTION: 55# @DESCRIPTION:
47# The distutils src_unpack function, this function is exported 56# The distutils src_unpack function, this function is exported.
48distutils_src_unpack() { 57distutils_src_unpack() {
49 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then 58 if [[ "${EBUILD_PHASE}" != "unpack" ]]; then
50 die "${FUNCNAME}() can be used only in src_unpack() phase" 59 die "${FUNCNAME}() can be used only in src_unpack() phase"
51 fi 60 fi
52 61
56 has "${EAPI:-0}" 0 1 && distutils_src_prepare 65 has "${EAPI:-0}" 0 1 && distutils_src_prepare
57} 66}
58 67
59# @FUNCTION: distutils_src_prepare 68# @FUNCTION: distutils_src_prepare
60# @DESCRIPTION: 69# @DESCRIPTION:
61# The distutils src_prepare function, this function is exported 70# The distutils src_prepare function, this function is exported.
62distutils_src_prepare() { 71distutils_src_prepare() {
63 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then 72 if ! has "${EAPI:-0}" 0 1 && [[ "${EBUILD_PHASE}" != "prepare" ]]; then
64 die "${FUNCNAME}() can be used only in src_prepare() phase" 73 die "${FUNCNAME}() can be used only in src_prepare() phase"
65 fi 74 fi
66 75
87 fi 96 fi
88} 97}
89 98
90# @FUNCTION: distutils_src_compile 99# @FUNCTION: distutils_src_compile
91# @DESCRIPTION: 100# @DESCRIPTION:
92# The distutils src_compile function, this function is exported 101# The distutils src_compile function, this function is exported.
102# In newer EAPIs this function calls distutils_src_compile_pre_hook() and
103# distutils_src_compile_post_hook(), if they are defined.
93distutils_src_compile() { 104distutils_src_compile() {
94 if [[ "${EBUILD_PHASE}" != "compile" ]]; then 105 if [[ "${EBUILD_PHASE}" != "compile" ]]; then
95 die "${FUNCNAME}() can be used only in src_compile() phase" 106 die "${FUNCNAME}() can be used only in src_compile() phase"
96 fi 107 fi
97 108
98 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 109 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
99 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then 110 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
100 building() { 111 building() {
112 _distutils_hook pre
113
101 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 114 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
102 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 115 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || return "$?"
116
117 _distutils_hook post
103 } 118 }
104 python_execute_function -s building "$@" 119 python_execute_function -s building "$@"
105 else 120 else
106 building() { 121 building() {
122 _distutils_hook pre
123
107 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 124 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@"
108 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" 125 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" "$@" || return "$?"
126
127 _distutils_hook post
109 } 128 }
110 python_execute_function building "$@" 129 python_execute_function building "$@"
111 fi 130 fi
112 else 131 else
132 python_version
113 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" 133 echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@"
114 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed" 134 "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build "$@" || die "Building failed"
115 fi 135 fi
116} 136}
117 137
118# @FUNCTION: distutils_src_install 138# @FUNCTION: distutils_src_install
119# @DESCRIPTION: 139# @DESCRIPTION:
120# The distutils src_install function, this function is exported. 140# The distutils src_install function, this function is exported.
141# In newer EAPIs this function calls distutils_src_install_pre_hook() and
142# distutils_src_install_post_hook(), if they are defined.
121# It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, MAINTAINERS, 143# It also installs the "standard docs" (CHANGELOG, Change*, KNOWN_BUGS, MAINTAINERS,
122# PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS) 144# PKG-INFO, CONTRIBUTORS, TODO, NEWS, MANIFEST*, README*, and AUTHORS)
123distutils_src_install() { 145distutils_src_install() {
124 if [[ "${EBUILD_PHASE}" != "install" ]]; then 146 if [[ "${EBUILD_PHASE}" != "install" ]]; then
125 die "${FUNCNAME}() can be used only in src_install() phase" 147 die "${FUNCNAME}() can be used only in src_install() phase"
131 python_need_rebuild 153 python_need_rebuild
132 154
133 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then 155 if ! has "${EAPI:-0}" 0 1 2 || [[ -n "${SUPPORT_PYTHON_ABIS}" ]]; then
134 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then 156 if [[ -n "${DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES}" ]]; then
135 installation() { 157 installation() {
158 _distutils_hook pre
159
136 # need this for python-2.5 + setuptools in cases where 160 # need this for python-2.5 + setuptools in cases where
137 # a package uses distutils but does not install anything 161 # a package uses distutils but does not install anything
138 # in site-packages. (eg. dev-java/java-config-2.x) 162 # in site-packages. (eg. dev-java/java-config-2.x)
139 # - liquidx (14/08/2006) 163 # - liquidx (14/08/2006)
140 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 164 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
141 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 165 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
142 166
143 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 167 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
144 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 168 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || return "$?"
169
170 _distutils_hook post
145 } 171 }
146 python_execute_function -s installation "$@" 172 python_execute_function -s installation "$@"
147 else 173 else
148 installation() { 174 installation() {
175 _distutils_hook pre
176
149 # need this for python-2.5 + setuptools in cases where 177 # need this for python-2.5 + setuptools in cases where
150 # a package uses distutils but does not install anything 178 # a package uses distutils but does not install anything
151 # in site-packages. (eg. dev-java/java-config-2.x) 179 # in site-packages. (eg. dev-java/java-config-2.x)
152 # - liquidx (14/08/2006) 180 # - liquidx (14/08/2006)
153 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 181 pylibdir="$("$(PYTHON)" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
154 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 182 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
155 183
156 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 184 echo "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@"
157 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" 185 "$(PYTHON)" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" build -b "build-${PYTHON_ABI}" install --root="${D}" --no-compile "$@" || return "$?"
186
187 _distutils_hook post
158 } 188 }
159 python_execute_function installation "$@" 189 python_execute_function installation "$@"
160 fi 190 fi
161 else 191 else
162 # need this for python-2.5 + setuptools in cases where 192 # need this for python-2.5 + setuptools in cases where
163 # a package uses distutils but does not install anything 193 # a package uses distutils but does not install anything
164 # in site-packages. (eg. dev-java/java-config-2.x) 194 # in site-packages. (eg. dev-java/java-config-2.x)
165 # - liquidx (14/08/2006) 195 # - liquidx (14/08/2006)
166 pylibdir="$(${python} -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')" 196 pylibdir="$("$(PYTHON "${PYVER}")" -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib())')"
167 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}" 197 [[ -n "${pylibdir}" ]] && dodir "${pylibdir}"
168 198
169 echo ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" 199 echo "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@"
170 ${python} setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed" 200 "$(PYTHON "${PYVER}")" setup.py "${DISTUTILS_GLOBAL_OPTIONS[@]}" install --root="${D}" --no-compile "$@" || die "Installation failed"
171 fi 201 fi
172 202
173 if [[ -e "${D}usr/local" ]]; then 203 if [[ -e "${D}usr/local" ]]; then
174 die "Illegal installation into /usr/local" 204 die "Illegal installation into /usr/local"
175 fi 205 fi
249} 279}
250 280
251# @FUNCTION: distutils_python_version 281# @FUNCTION: distutils_python_version
252# @DESCRIPTION: 282# @DESCRIPTION:
253# Calls python_version, so that you can use something like 283# Calls python_version, so that you can use something like
254# e.g. insinto ${ROOT}/usr/include/python${PYVER} 284# e.g. insinto ${ROOT}/usr/include/python${PYVER}
255distutils_python_version() { 285distutils_python_version() {
256 python_version 286 python_version
257} 287}
258 288
259# @FUNCTION: distutils_python_tkinter 289# @FUNCTION: distutils_python_tkinter

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67

  ViewVC Help
Powered by ViewVC 1.1.20