1 |
arfrever 09/08/29 02:15:24 |
2 |
|
3 |
Modified: python.eclass |
4 |
Log: |
5 |
Ensure that defined functions are passed to python_execute_function(). Add PYTHON_DEFINE_DEFAULT_FUNCTIONS variable. |
6 |
|
7 |
Revision Changes Path |
8 |
1.67 eclass/python.eclass |
9 |
|
10 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.67&view=markup |
11 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?rev=1.67&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/python.eclass?r1=1.66&r2=1.67 |
13 |
|
14 |
Index: python.eclass |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-x86/eclass/python.eclass,v |
17 |
retrieving revision 1.66 |
18 |
retrieving revision 1.67 |
19 |
diff -u -r1.66 -r1.67 |
20 |
--- python.eclass 28 Aug 2009 16:08:51 -0000 1.66 |
21 |
+++ python.eclass 29 Aug 2009 02:15:24 -0000 1.67 |
22 |
@@ -1,6 +1,6 @@ |
23 |
# Copyright 1999-2009 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.66 2009/08/28 16:08:51 arfrever Exp $ |
26 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.67 2009/08/29 02:15:24 arfrever Exp $ |
27 |
|
28 |
# @ECLASS: python.eclass |
29 |
# @MAINTAINER: |
30 |
@@ -233,7 +233,7 @@ |
31 |
separate_build_dirs="1" |
32 |
;; |
33 |
-*) |
34 |
- die "${FUNCNAME}(): Unrecognized option $1" |
35 |
+ die "${FUNCNAME}(): Unrecognized option '$1'" |
36 |
;; |
37 |
*) |
38 |
break |
39 |
@@ -248,12 +248,16 @@ |
40 |
fi |
41 |
function="$1" |
42 |
shift |
43 |
+ |
44 |
+ if [[ -z "$(type -t "${function}")" ]]; then |
45 |
+ die "${FUNCNAME}(): '${function}' function isn't defined" |
46 |
+ fi |
47 |
else |
48 |
if [[ "$#" -ne "0" ]]; then |
49 |
- die "${FUNCNAME}(): --default-function option and function name cannot be specified simultaneously" |
50 |
+ die "${FUNCNAME}(): '--default-function' option and function name cannot be specified simultaneously" |
51 |
fi |
52 |
if has "${EAPI:-0}" 0 1; then |
53 |
- die "${FUNCNAME}(): --default-function option cannot be used in this EAPI" |
54 |
+ die "${FUNCNAME}(): '--default-function' option cannot be used in this EAPI" |
55 |
fi |
56 |
|
57 |
if [[ "${EBUILD_PHASE}" == "configure" ]]; then |
58 |
@@ -392,7 +396,7 @@ |
59 |
# @DESCRIPTION: |
60 |
# Makes sure PYTHON_USE_WITH or PYTHON_USE_WITH_OR listed use flags |
61 |
# are respected. Only exported if one of those variables is set. |
62 |
-if ! has ${EAPI:-0} 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then |
63 |
+if ! has "${EAPI:-0}" 0 1 && [[ -n ${PYTHON_USE_WITH} || -n ${PYTHON_USE_WITH_OR} ]]; then |
64 |
python_pkg_setup_fail() { |
65 |
eerror "${1}" |
66 |
die "${1}" |
67 |
@@ -444,6 +448,23 @@ |
68 |
RDEPEND="${PYTHON_USE_WITH_ATOM}" |
69 |
fi |
70 |
|
71 |
+# @ECLASS-VARIABLE: PYTHON_DEFINE_DEFAULT_FUNCTIONS |
72 |
+# @DESCRIPTION: |
73 |
+# Set this to define default functions for the following ebuild phases: |
74 |
+# src_prepare, src_configure, src_compile, src_test, src_install. |
75 |
+if ! has "${EAPI:-0}" 0 1 && [[ -n "${PYTHON_DEFINE_DEFAULT_FUNCTIONS}" ]]; then |
76 |
+ python_src_prepare() { |
77 |
+ python_copy_sources |
78 |
+ } |
79 |
+ |
80 |
+ for python_default_function in src_configure src_compile src_test src_install; do |
81 |
+ eval "python_${python_default_function}() { python_execute_function -d -s; }" |
82 |
+ done |
83 |
+ unset python_default_function |
84 |
+ |
85 |
+ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install |
86 |
+fi |
87 |
+ |
88 |
# @FUNCTION: python_disable_pyc |
89 |
# @DESCRIPTION: |
90 |
# Tell Python not to automatically recompile modules to .pyc/.pyo |