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