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

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

  ViewVC Help
Powered by ViewVC 1.1.20