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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations) (download)
Wed May 13 02:11:24 2009 UTC (5 years, 6 months ago) by nixphoeni
Branch: MAIN
Changes since 1.17: +2 -2 lines
Make the search for external scripts smarter

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

  ViewVC Help
Powered by ViewVC 1.1.20