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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (show annotations) (download)
Sat May 8 19:04:04 2010 UTC (4 years, 4 months ago) by nixphoeni
Branch: MAIN
Changes since 1.18: +2 -8 lines
Tried to fix bug #314653

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.18 2009/05/13 02:11:24 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 debug-print-section sensor_install
58 # First, install the Sensor (if there is one)
59 if [[ -n "${SENSOR_NAME}" ]]; then
60 for SENS in ${SENSOR_NAME[@]}; do
61 einfo "Installing Sensor ${SENS}"
62 /usr/bin/python "Install_${SENS}_Sensor.bin" \
63 --nomsg "${D}${GDESKLETS_INST_DIR}/Sensors" || \
64 die "Couldn't Install Sensor"
65
66 chown -R root:0 "${D}${GDESKLETS_INST_DIR}/Sensors/${SENSOR_NAME}"
67 done # for in ${SENSOR_NAME}
68 fi # if -n "${SENSOR_NAME}"
69
70 debug-print-section display_install
71 # This finds the Displays
72 DISPLAY_FILES=(`find . -iname "*.display"`)
73
74 DESKLET_INSDIR=""
75
76 # There is most likely only one display per package
77 if [[ -n "${DISPLAY_FILES[@]}" ]]; then
78 # Base installation directory for displays from this desklet
79 DESKLET_INSDIR="${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
80
81 # This creates the subdirectory of ${DESKLET_NAME}
82 # in the global Displays directory
83 [[ -d "${DESKLET_INSDIR}" ]] || \
84 dodir "${DESKLET_INSDIR}"
85
86 # For each of the Display files, there may be
87 # scripts included inline which don't necessarily
88 # follow any naming scheme.
89 # So for each of them, determine what those scripts are
90 # and install them.
91 for DSP in ${DISPLAY_FILES[@]}; do
92
93 cd `dirname ${DSP}`
94 einfo "Installing Display `basename ${DSP} .display`"
95 debug-print "Installing ${DSP} into ${DESKLET_INSDIR}"
96 DSP=`basename ${DSP}`
97 insinto "${DESKLET_INSDIR}"
98 doins "${DSP}"
99
100 SCRIPTS=$(grep "script .*uri" ${DSP} | \
101 sed -e "s:.*<script\b.*\buri=[\"']: :g" -e "s:[\"'].*/>.*: :g")
102
103 # For each one of the scripts, change to its
104 # base directory and change the install location
105 # so it gets installed at the proper place
106 # relative to the display.
107 for SCR in ${SCRIPTS[@]}; do
108
109 insinto "${DESKLET_INSDIR}/`dirname ${SCR}`"
110 doins "${SCR}"
111 debug-print "Installed ${SCR} into ${DESKLET_INSDIR}/`dirname ${SCR}`"
112
113 done # for in ${SCRIPTS}
114
115 # Install the graphics for this display.
116 # If there are multiple displays in this
117 # directory, this will be done more than
118 # once. It's the only solution I can
119 # come up with for now...
120 GFX=(`find . \
121 -iname "*.png" -o -iname "*.svg" \
122 -o -iname "*.jpg" -o -iname "*.gif" \
123 -o -iname "*.xcf"`)
124
125 for G in ${GFX[@]}; do
126
127 insinto "${DESKLET_INSDIR}/`dirname ${G}`"
128 doins "${G}"
129 debug-print "Installed ${G} into ${DESKLET_INSDIR}/`dirname ${G}`"
130
131 done # for in ${GFX}
132
133 cd "${S}"
134
135 done # for in ${DISPLAY_FILES}
136
137 fi
138
139 debug-print-section control_install
140
141 CONTROL_INSDIR=""
142
143 # Make sure that it only finds Controls and not Sensors
144 # If it uses a Sensor, it shouldn't use a Control (since
145 # Sensors are deprecated).
146 if [[ -z "${SENSOR_NAME}" ]]; then
147
148 # Base installation directory for Controls
149 CONTROL_INSDIR="${GDESKLETS_INST_DIR}/Controls"
150
151 CONTROL_INITS=$(find . -iname "__init__.py")
152
153 # There are possibly multiple Controls packaged with the display.
154 # For each __init__.py found, there must be a Control associated with it.
155 for CTRL in ${CONTROL_INITS[@]}; do
156
157 cd `dirname ${CTRL}`
158 CTRL_NAME=$( "${GDESKLETS_INST_DIR}/gdesklets-control-getid" `pwd` 2> /dev/null )
159 einfo "Installing Control ${CTRL_NAME}"
160 # This creates the subdirectory of ${CTRL_NAME}
161 # in the global Controls directory
162 [[ -d "${CONTROL_INSDIR}/${CTRL_NAME}" ]] || \
163 dodir "${CONTROL_INSDIR}/${CTRL_NAME}"
164
165 insinto "${CONTROL_INSDIR}/${CTRL_NAME}"
166
167 doins -r *.py
168
169 cd "${S}"
170
171 done # for in ${CONTROL_INITS}
172
173 fi # if no Sensors
174
175 # Install any remaining graphics and other files
176 # that are sitting in ${S}.
177
178 GFX=$(find . -maxdepth 1 \
179 -iname "*.png" -o -iname "*.svg" \
180 -o -iname "*.jpg" -o -iname "*.gif" \
181 -o -iname "*.xcf")
182
183 if [[ -n "${GFX}" ]]; then
184
185 # Install to the Displays directory of the Desklet
186 insinto "${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
187 doins "${GFX}"
188 debug-print "Installed ${GFX} into ${GDESKLETS_INST_DIR}/Displays/${DESKLET_NAME}"
189
190 fi # if -n "${GFX}"
191
192 # Install some docs if so requested
193 [[ -n "${DOCS}" ]] && dodoc ${DOCS} && \
194 debug-print "Installed ${DOCS}"
195
196 }
197
198
199 EXPORT_FUNCTIONS src_install

  ViewVC Help
Powered by ViewVC 1.1.20