Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-python] [PATCH distutils-r1] Support EXAMPLES for installing examples.
Date: Fri, 15 Feb 2013 23:56:09
Message-Id: 1360972573-21766-1-git-send-email-mgorny@gentoo.org
1 A lot of ebuilds is installing examples manually. In EAPI 4+ this
2 additionally requires calling 'docompress' to disable compressing them.
3
4 To make that simpler, introduce EXAMPLES aside to HTML_DOCS and DOCS.
5 ---
6 gx86/eclass/distutils-r1.eclass | 33 +++++++++++++++++++++++++++++----
7 1 file changed, 29 insertions(+), 4 deletions(-)
8
9 diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
10 index e662fa2..f3f8f73 100644
11 --- a/gx86/eclass/distutils-r1.eclass
12 +++ b/gx86/eclass/distutils-r1.eclass
13 @@ -151,7 +151,25 @@ fi
14 #
15 # Example:
16 # @CODE
17 -# HTML_DOCS=( doc/html/ )
18 +# HTML_DOCS=( doc/html/. )
19 +# @CODE
20 +
21 +# @ECLASS-VARIABLE: EXAMPLES
22 +# @DEFAULT_UNSET
23 +# @DESCRIPTION:
24 +# An array containing examples installed into 'examples' doc
25 +# subdirectory. The files and directories listed there must exist
26 +# in the directory from which distutils-r1_python_install_all() is run
27 +# (${S} by default).
28 +#
29 +# The 'examples' subdirectory will be marked not to be compressed
30 +# automatically.
31 +#
32 +# If unset, no examples will be installed.
33 +#
34 +# Example:
35 +# @CODE
36 +# EXAMPLES=( examples/. demos/. )
37 # @CODE
38
39 # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
40 @@ -487,7 +505,7 @@ distutils-r1_python_install_all() {
41 if declare -p DOCS &>/dev/null; then
42 # an empty list == don't install anything
43 if [[ ${DOCS[@]} ]]; then
44 - dodoc -r "${DOCS[@]}" || die "dodoc failed"
45 + dodoc -r "${DOCS[@]}"
46 fi
47 else
48 local f
49 @@ -495,13 +513,20 @@ distutils-r1_python_install_all() {
50 for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \
51 THANKS BUGS FAQ CREDITS CHANGELOG; do
52 if [[ -s ${f} ]]; then
53 - dodoc "${f}" || die "(default) dodoc ${f} failed"
54 + dodoc "${f}"
55 fi
56 done
57 fi
58
59 if declare -p HTML_DOCS &>/dev/null; then
60 - dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
61 + dohtml -r "${HTML_DOCS[@]}"
62 + fi
63 +
64 + if declare -p EXAMPLES &>/dev/null; then
65 + local DOCDESTTREE=examples
66 + dodoc -r "${EXAMPLES[@]}"
67 +
68 + docompress -x /usr/share/doc/${PF}/examples
69 fi
70 }
71
72 --
73 1.8.1.2

Replies