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

Diff of /eclass/gdesklets.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20