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

Diff of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20