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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Fri May 26 04:14:58 2006 UTC (7 years, 10 months ago) by nixphoeni
Branch: MAIN
Changes since 1.12: +10 -4 lines
Cleaned up the way that python module compilation is handled and resolved bug 126890

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

  ViewVC Help
Powered by ViewVC 1.1.20