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

Contents of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.17 - (hide annotations) (download)
Tue Apr 28 00:57:18 2009 UTC (4 years, 11 months ago) by nixphoeni
Branch: MAIN
Changes since 1.16: +8 -7 lines
Unquoted  for use in dodoc (doesn't work with multiple filenames).  Updated SRC_URI (for desklets - Controls have to do some rewriting).  Also, Controls should be packaged by themselves so we shouldn't need to grep for [Cc]ontrols when searching for a directory with an __init__.py in order to determine the base directory for the control.

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

  ViewVC Help
Powered by ViewVC 1.1.20