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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.19 - (hide annotations) (download)
Sat May 8 19:04:04 2010 UTC (3 years, 11 months ago) by nixphoeni
Branch: MAIN
Changes since 1.18: +2 -8 lines
Tried to fix bug #314653

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

  ViewVC Help
Powered by ViewVC 1.1.20