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

Diff of /eclass/gdesklets.eclass

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

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

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20