1 |
If a particular package uses distutils part only conditionally |
2 |
(e.g. with USE=python), you can do something like: |
3 |
|
4 |
DISTUTILS_OPTIONAL=1 |
5 |
RDEPEND="python? ( ${PYTHON_DEPS} )" |
6 |
src_compile() { cd python; use python && distutils-r1_src_compile; } |
7 |
src_test() { cd python; use python && distutils-r1_src_test; } |
8 |
src_install() { cd python; use python && distutils-r1_src_install; } |
9 |
--- |
10 |
gx86/eclass/distutils-r1.eclass | 22 +++++++++++++++++++--- |
11 |
1 file changed, 19 insertions(+), 3 deletions(-) |
12 |
|
13 |
diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass |
14 |
index 6a062ae..80734c5 100644 |
15 |
--- a/gx86/eclass/distutils-r1.eclass |
16 |
+++ b/gx86/eclass/distutils-r1.eclass |
17 |
@@ -54,18 +54,34 @@ case "${EAPI:-0}" in |
18 |
;; |
19 |
esac |
20 |
|
21 |
+# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL |
22 |
+# @DEFAULT_UNSET |
23 |
+# @DESCRIPTION: |
24 |
+# If set to a non-null value, distutils part in the ebuild will |
25 |
+# be considered optional. No dependencies will be added and no phase |
26 |
+# functions will be exported. |
27 |
+# |
28 |
+# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies |
29 |
+# for your package (using ${PYTHON_DEPS}) and to either call |
30 |
+# distutils-r1 default phase functions or call the build system |
31 |
+# manually. |
32 |
+ |
33 |
if [[ ! ${_DISTUTILS_R1} ]]; then |
34 |
|
35 |
inherit eutils multiprocessing python-r1 |
36 |
|
37 |
fi |
38 |
|
39 |
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install |
40 |
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then |
41 |
+ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install |
42 |
+fi |
43 |
|
44 |
if [[ ! ${_DISTUTILS_R1} ]]; then |
45 |
|
46 |
-RDEPEND=${PYTHON_DEPS} |
47 |
-DEPEND=${PYTHON_DEPS} |
48 |
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then |
49 |
+ RDEPEND=${PYTHON_DEPS} |
50 |
+ DEPEND=${PYTHON_DEPS} |
51 |
+fi |
52 |
|
53 |
# @ECLASS-VARIABLE: DISTUTILS_JOBS |
54 |
# @DEFAULT_UNSET |
55 |
-- |
56 |
1.8.1.1 |