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

Diff of /eclass/python.eclass

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

Revision 1.57 Revision 1.58
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/python.eclass,v 1.57 2009/08/02 16:56:41 arfrever Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.58 2009/08/03 22:28:01 arfrever Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# python@gentoo.org 7# python@gentoo.org
8# 8#
185 rm -f "${dir}" || die "Deletion of '${dir}' failed" 185 rm -f "${dir}" || die "Deletion of '${dir}' failed"
186 ln -s "${dir}-${PYTHON_ABI}" "${dir}" || die "Creation of '${dir}' directory symlink failed" 186 ln -s "${dir}-${PYTHON_ABI}" "${dir}" || die "Creation of '${dir}' directory symlink failed"
187} 187}
188 188
189# @FUNCTION: python_execute_function 189# @FUNCTION: python_execute_function
190# @USAGE: [--action-message message] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] <function> [arguments] 190# @USAGE: [--action-message message] [-d|--default-function] [--failure-message message] [--nonfatal] [-q|--quiet] [-s|--separate-build-dirs] <function> [arguments]
191# @DESCRIPTION: 191# @DESCRIPTION:
192# Execute specified function for each value of PYTHON_ABIS, optionally passing 192# Execute specified function for each value of PYTHON_ABIS, optionally passing
193# additional arguments. The specified function can use PYTHON_ABI variable. 193# additional arguments. The specified function can use PYTHON_ABI variable.
194python_execute_function() { 194python_execute_function() {
195 local action action_message action_message_template= failure_message failure_message_template= function nonfatal="0" PYTHON_ABI quiet="0" separate_build_dirs="0" 195 local action action_message action_message_template= default_function="0" failure_message failure_message_template= function nonfatal="0" PYTHON_ABI quiet="0" separate_build_dirs="0"
196 196
197 while (($#)); do 197 while (($#)); do
198 case "$1" in 198 case "$1" in
199 --action-message) 199 --action-message)
200 action_message_template="$2" 200 action_message_template="$2"
201 shift 201 shift
202 ;; 202 ;;
203 -d|--default-function)
204 default_function="1"
205 ;;
203 --failure-message) 206 --failure-message)
204 failure_message_template="$2" 207 failure_message_template="$2"
205 shift 208 shift
206 ;; 209 ;;
207 --nonfatal) 210 --nonfatal)
221 ;; 224 ;;
222 esac 225 esac
223 shift 226 shift
224 done 227 done
225 228
229 if [[ "${default_function}" == "0" ]]; then
226 if [[ "$#" -eq "0" ]]; then 230 if [[ "$#" -eq "0" ]]; then
227 die "${FUNCNAME}(): Missing function name" 231 die "${FUNCNAME}(): Missing function name"
228 fi 232 fi
229 function="$1" 233 function="$1"
230 shift 234 shift
235 else
236 if [[ "$#" -ne "0" ]]; then
237 die "${FUNCNAME}(): --default-function option and function name cannot be specified simultaneously"
238 fi
239 if has "${EAPI:-0}" 0 1; then
240 die "${FUNCNAME}(): --default-function option cannot be used in this EAPI"
241 fi
242
243 if [[ "${EBUILD_PHASE}" == "configure" ]]; then
244 python_default_function() {
245 econf
246 }
247 elif [[ "${EBUILD_PHASE}" == "compile" ]]; then
248 python_default_function() {
249 emake
250 }
251 elif [[ "${EBUILD_PHASE}" == "test" ]]; then
252 python_default_function() {
253 if emake -j1 -n check &> /dev/null; then
254 emake -j1 check
255 elif emake -j1 -n test &> /dev/null; then
256 emake -j1 test
257 fi
258 }
259 elif [[ "${EBUILD_PHASE}" == "install" ]]; then
260 python_default_function() {
261 emake DESTDIR="${D}" install
262 }
263 else
264 die "${FUNCNAME}(): --default-function option cannot be used in this ebuild phase"
265 fi
266 function="python_default_function"
267 fi
231 268
232 if [[ "${quiet}" == "0" ]]; then 269 if [[ "${quiet}" == "0" ]]; then
233 [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up" 270 [[ "${EBUILD_PHASE}" == "setup" ]] && action="Setting up"
234 [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking" 271 [[ "${EBUILD_PHASE}" == "unpack" ]] && action="Unpacking"
235 [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation" 272 [[ "${EBUILD_PHASE}" == "prepare" ]] && action="Preparation"
290 fi 327 fi
291 if [[ "${separate_build_dirs}" == "1" ]]; then 328 if [[ "${separate_build_dirs}" == "1" ]]; then
292 popd > /dev/null || die "popd failed" 329 popd > /dev/null || die "popd failed"
293 fi 330 fi
294 done 331 done
332
333 if [[ "${default_function}" == "1" ]]; then
334 unset -f python_default_function
335 fi
295} 336}
296 337
297 338
298# @ECLASS-VARIABLE: PYTHON_USE_WITH 339# @ECLASS-VARIABLE: PYTHON_USE_WITH
299# @DESCRIPTION: 340# @DESCRIPTION:

Legend:
Removed from v.1.57  
changed lines
  Added in v.1.58

  ViewVC Help
Powered by ViewVC 1.1.20