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

Diff of /eclass/gdesklets.eclass

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

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

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

  ViewVC Help
Powered by ViewVC 1.1.20