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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide annotations) (download)
Fri Feb 17 22:18:20 2006 UTC (8 years, 7 months ago) by swegener
Branch: MAIN
Changes since 1.11: +3 -3 lines
Apply whitespace checks from repoman to eclasses.

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

  ViewVC Help
Powered by ViewVC 1.1.20