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

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

  ViewVC Help
Powered by ViewVC 1.1.20