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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Tue Oct 16 22:46:31 2007 UTC (7 years, 1 month ago) by nixphoeni
Branch: MAIN
Changes since 1.14: +19 -19 lines
QA fixes \(quoting\) - hopefully we won\'t need to go back and rewrite the whole thing.  It should be deprecated pretty soon.

1 # Copyright 2004-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License, v2 or later
3 # $Header: /var/cvsroot/gentoo-x86/eclass/gdesklets.eclass,v 1.14 2006/05/26 04:18:43 nixphoeni Exp $
4 #
5 # Authors: Joe Sapp <nixphoeni@gentoo.org>
6 # Mike Gardiner <obz@gentoo.org>
7 #
8 # Usage:
9 # As a writer for an ebuild for gDesklets, you should set a few things:
10 #
11 # DESKLET_NAME: The name of the desklet.
12 # DOCS: Anything (like a README) that should be dodoc'd.
13 # S: *Optional* The package's base directory.
14 # Usually ${WORKDIR}/${DESKLET_NAME} if it was packaged
15 # correctly (hence, this is the default).
16 # RDEPEND: *Optional* Set if the desklet requires a minimum version
17 # of gDesklets greater than 0.34 or other packages.
18
19 inherit eutils multilib python
20
21
22 MY_P="${DESKLET_NAME}-${PV}"
23 S=${WORKDIR}/${DESKLET_NAME}
24
25 SRC_URI="http://gdesklets.gnomedesktop.org/files/${MY_P}.tar.gz"
26
27 # Ebuild writer shouldn't need to touch these (except maybe $RDEPEND)
28 SLOT="0"
29 IUSE=""
30 RDEPEND=">=gnome-extra/gdesklets-core-0.34.3-r1"
31
32 GDESKLETS_INST_DIR="${ROOT}usr/$(get_libdir)/gdesklets"
33
34 gdesklets_src_install() {
35
36 debug-print-function $FUNCNAME $*
37
38 # Disable compilation of included python modules (Controls)
39 python_disable_pyc
40
41 # Do not remove - see bugs 126890 and 128289
42 addwrite "${ROOT}/root/.gnome2"
43
44 has_version ">=gnome-extra/gdesklets-core-0.33.1" || \
45 GDESKLETS_INST_DIR="/usr/share/gdesklets"
46
47 # This should be done by the gdesklets-core ebuild
48 # It makes the Displays or Controls directory in the
49 # global installation directory if it doesn't exist
50 [[ -d "${GDESKLETS_INST_DIR}/Displays" ]] || \
51 dodir "${GDESKLETS_INST_DIR}/Displays"
52
53 # The displays only need to be readable
54 insopts -m0744
55
56 # Check to see if DISPLAY is set for the
57 # gdesklets-control-getid script to run without
58 # error
59 [ -z "${DISPLAY}" ] && DISPLAY=""
60 export DISPLAY
61
62 debug-print-section sensor_install
63 # First, install the Sensor (if there is one)
64 if [[ -n "${SENSOR_NAME}" ]]; then
65 for SENS in ${SENSOR_NAME[@]}; do
66 einfo "Installing Sensor ${SENS}"
67 /usr/bin/python "Install_${SENS}_Sensor.bin" \
68 --nomsg ${D}${GDESKLETS_INST_DIR}/Sensors || \
69 die "Couldn't Install Sensor"
70
71 chown -R root:0 ${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME}
72 done # for in ${SENSOR_NAME}
73 fi # if -n "${SENSOR_NAME}"
74
75 debug-print-section display_install
76 # This finds the Displays
77 DISPLAY_FILES=(`find . -iname "*.display"`)
78
79 DESKLET_INSDIR=""
80
81 # There is most likely only one display per package
82 if [[ -n "${DISPLAY_FILES[@]}" ]]; then
83 # Base installation directory for displays from this desklet
84 DESKLET_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
85
86 # This creates the subdirectory of ${DESKLET_NAME}
87 # in the global Displays directory
88 [[ -d "${DESKLET_INSDIR}" ]] || \
89 dodir "${DESKLET_INSDIR}"
90
91 # For each of the Display files, there may be
92 # scripts included inline which don't necessarily
93 # follow any naming scheme.
94 # So for each of them, determine what those scripts are
95 # and install them.
96 for DSP in ${DISPLAY_FILES[@]}; do
97
98 cd `dirname ${DSP}`
99 einfo "Installing Display `basename ${DSP} .display`"
100 debug-print "Installing ${DSP} into ${DESKLET_INSDIR}"
101 DSP=`basename ${DSP}`
102 insinto "${DESKLET_INSDIR}"
103 doins ${DSP}
104
105 SCRIPTS=$(grep "script .*uri" ${DSP} | \
106 sed -e 's:.*<script .*uri=": :g' -e 's:"/>.*: :g')
107
108 # For each one of the scripts, change to its
109 # base directory and change the install location
110 # so it gets installed at the proper place
111 # relative to the display.
112 for SCR in ${SCRIPTS[@]}; do
113
114 insinto "${DESKLET_INSDIR}/`dirname ${SCR}`"
115 doins "${SCR}"
116 debug-print "Installed ${SCR} into ${DESKLET_INSDIR}/`dirname ${SCR}`"
117
118 done # for in ${SCRIPTS}
119
120 # Install the graphics for this display.
121 # If there are multiple displays in this
122 # directory, this will be done more than
123 # once. It's the only solution I can
124 # come up with for now...
125 GFX=(`find . \
126 -iname "*.png" -o -iname "*.svg" \
127 -o -iname "*.jpg" -o -iname "*.gif" \
128 -o -iname "*.xcf"`)
129
130 for G in ${GFX[@]}; do
131
132 insinto "${DESKLET_INSDIR}/`dirname ${G}`"
133 doins "${G}"
134 debug-print "Installed ${G} into ${DESKLET_INSDIR}/`dirname ${G}`"
135
136 done # for in ${GFX}
137
138 cd "${S}"
139
140 done # for in ${DISPLAY_FILES}
141
142 fi
143
144 debug-print-section control_install
145
146 CONTROL_INSDIR=""
147
148 # Make sure that it only finds Controls and not Sensors
149 # If it uses a Sensor, it shouldn't use a Control (since
150 # Sensors are deprecated).
151 if [[ -z "${SENSOR_NAME}" ]]; then
152
153 # Base installation directory for Controls
154 CONTROL_INSDIR="${GDESKLETS_INST_DIR}/Controls"
155
156 CONTROL_INITS=$(find . -iname "__init__.py" | grep [Cc]ontrols)
157
158 # There are possibly multiple Controls packaged with the display.
159 # For each __init__.py found, there must be a Control associated with it.
160 for CTRL in ${CONTROL_INITS[@]}; do
161
162 cd `dirname ${CTRL}`
163 CTRL_NAME=$( ${GDESKLETS_INST_DIR}/gdesklets-control-getid `pwd` )
164 einfo "Installing Control ${CTRL_NAME}"
165 # This creates the subdirectory of ${CTRL_NAME}
166 # in the global Controls directory
167 [[ -d "${CONTROL_INSDIR}/${CTRL_NAME}" ]] || \
168 dodir "${CONTROL_INSDIR}/${CTRL_NAME}"
169
170 insinto "${CONTROL_INSDIR}/${CTRL_NAME}"
171
172 doins -r *
173
174 cd "${S}"
175
176 done # for in ${CONTROL_INITS}
177
178 fi # if no Sensors
179
180 # Install any remaining graphics and other files
181 # that are sitting in ${S}.
182
183 GFX=$(find . -maxdepth 1 \
184 -iname "*.png" -o -iname "*.svg" \
185 -o -iname "*.jpg" -o -iname "*.gif" \
186 -o -iname "*.xcf")
187
188 if [[ -n "${GFX}" ]]; then
189
190 # Install to the Displays directory of the Desklet
191 insinto "${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
192 doins "${GFX}"
193 debug-print "Installed ${GFX} into ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
194
195 fi # if -n "${GFX}"
196
197 # Install some docs if so requested
198 [[ -n "${DOCS}" ]] && dodoc "${DOCS}" && \
199 debug-print "Installed ${DOCS}"
200
201 }
202
203
204 EXPORT_FUNCTIONS src_install

  ViewVC Help
Powered by ViewVC 1.1.20