Gentoo Archives: gentoo-commits

From: "Ryan Hill (dirtyepic)" <dirtyepic@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-admin/eselect-wxwidgets/files: wxrc-0.5 digest-eselect-wxwidgets-0.5 wxwidgets.eselect-0.5 wx-config-0.5
Date: Sun, 18 Nov 2007 21:31:59
Message-Id: E1ItrZm-0005LV-RB@stork.gentoo.org
1 dirtyepic 07/11/18 21:21:10
2
3 Added: wxrc-0.5 digest-eselect-wxwidgets-0.5
4 wxwidgets.eselect-0.5 wx-config-0.5
5 Log:
6 Initial revision.
7 (Portage version: 2.1.3.19)
8
9 Revision Changes Path
10 1.1 app-admin/eselect-wxwidgets/files/wxrc-0.5
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wxrc-0.5?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wxrc-0.5?rev=1.1&content-type=text/plain
14
15 Index: wxrc-0.5
16 ===================================================================
17 #!/bin/sh -
18 #
19 # /usr/bin/wxrc
20 # another lame wrapper by dirtyepic@g.o
21
22 $(/usr/bin/wx-config --utility=wxrc) $@
23
24
25
26 1.1 app-admin/eselect-wxwidgets/files/digest-eselect-wxwidgets-0.5
27
28 <<Binary file>>
29
30
31 1.1 app-admin/eselect-wxwidgets/files/wxwidgets.eselect-0.5
32
33 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wxwidgets.eselect-0.5?rev=1.1&view=markup
34 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wxwidgets.eselect-0.5?rev=1.1&content-type=text/plain
35
36 Index: wxwidgets.eselect-0.5
37 ===================================================================
38 # Copyright 1999-2007 Gentoo Foundation
39 # Distributed under the terms of the GNU General Public License v2
40 # $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-wxwidgets/files/wxwidgets.eselect-0.5,v 1.1 2007/11/18 21:21:10 dirtyepic Exp $
41
42 inherit config
43
44 DESCRIPTION="Manage the system default wxWidgets profile."
45 MAINTAINER="dirtyepic@g.o"
46 VERSION=0.5
47
48 WXCONFFILE=/var/lib/wxwidgets/current
49 WXCONFDIR=/usr/lib/wx/config
50
51 find_targets() {
52 local conf
53 for conf in ${WXCONFDIR}/*; do
54 [[ -f ${conf} && -x ${conf} ]] && basename ${conf}
55 done
56 }
57
58 set_config() {
59 local target="${1}" targets
60
61 # selected by number
62 if is_number "${target}"; then
63 targets=( $(find_targets) )
64 [[ ${1} -ge 1 && ${1} -le ${#targets[@]} ]] \
65 || die -q "Number out of range: ${1}"
66 target=${targets[$(( ${target} - 1 ))]}
67 fi
68
69 if [[ ${target} == "none" ]]; then
70 # none is a special case
71 :
72 else
73 [[ ! -f ${WXCONFDIR}/${target} ]] && \
74 die -q "\"${1}\" doesn't appear to be a valid profile name."
75 fi
76
77 echo
78 echo "Setting wxWidgets profile to ${target}."
79 echo
80 store_config ${WXCONFFILE} WXCONFIG ${target}
81 }
82
83 ### show action ###
84
85 describe_show() {
86 echo "Show the currently selected profile."
87 }
88
89 do_show() {
90 [[ ${#@} -gt 0 ]] && die -q "Too many parameters"
91
92 write_list_start "Current wxWidgets profile:"
93 if [[ -e ${WXCONFFILE} ]]; then
94 write_kv_list_entry "$(load_config ${WXCONFFILE} WXCONFIG)" ""
95 else
96 write_kv_list_entry "(none)" ""
97 fi
98 }
99
100 ### list action ###
101
102 describe_list() {
103 echo "List available profiles."
104 }
105
106 do_list() {
107 local i targets
108 # targets is an array containing names of available configs
109 targets=( $(find_targets) )
110
111 if [[ -n ${targets[@]} ]]; then
112 for (( i = 0; i < ${#targets[@]}; i++ )); do
113 if [[ -e ${WXCONFFILE} ]]; then
114 # highlight current version
115 [[ ${targets[${i}]} == $(load_config ${WXCONFFILE} WXCONFIG) ]] \
116 && targets[${i}]="$(highlight ${targets[${i}]}) *"
117 fi
118 done
119 write_list_start "Available wxWidgets profiles:"
120 write_numbered_list "${targets[@]}"
121 else
122 write_kv_list_entry "(none found)" ""
123 fi
124 }
125
126 ### set action ###
127
128 describe_set() {
129 echo "Set the system wxWidgets profile."
130 }
131
132 describe_set_options() {
133 echo "target: profile name or number (gotten from 'list')"
134 }
135
136 describe_set_parameters() {
137 echo "<target>"
138 }
139
140 do_set() {
141 [[ ! ${#@} -eq 1 ]] \
142 && die -q "You must specify a profile name or number"
143
144 [[ -w "${ROOT}"/var/lib ]] \
145 || die -q "You need proper write permissions. Please run as root."
146
147 set_config "${1}"
148 }
149
150 describe_update() {
151 echo "Check the validity of the current profile and update it if invalid."
152 }
153
154 do_update() {
155 # the only way we'd be without a conffile is if the user deleted it
156 # easy enough to generate a new one though
157 if [[ ! -e ${WXCONFFILE} ]]; then
158 echo
159 write_warning_msg "Could not find a current wxWidgets profile."
160 write_warning_msg
161 write_warning_msg "Please use eselect wxwidgets to set one."
162 echo
163 return 1
164 fi
165
166 currconf=$(load_config ${WXCONFFILE} WXCONFIG)
167
168 # if current config is valid, leave it alone
169 if [[ -e ${WXCONFDIR}/${currconf} ]]; then
170 echo
171 echo "Current wxWidgets profile is valid."
172 echo
173 return 0
174 fi
175
176 # split the config string into components
177 OIFS=${IFS}
178 IFS=-
179 set -- ${currconf}
180 IFS=${OIFS}
181
182 declare -a wxtoolkit wxchar wxdebug wxver
183
184 # put selected components into the first element of the array
185 wxtoolkit=(${1})
186 wxchar=(${2})
187 wxdebug=(${3})
188 wxver=(${4})
189
190
191 # put available components into next element(s) of array
192 local component toolkit char debug ver element opt
193
194 for component in toolkit char debug ver; do
195 element=1
196 case ${component} in
197 toolkit)
198 for opt in base gtk2; do
199 if [[ ${opt} == ${wxtoolkit[0]} ]]; then
200 continue
201 else
202 wxtoolkit[${element}]=${opt}
203 (( element++ ))
204 fi
205 done
206 ;;
207
208 char)
209 for opt in ansi unicode; do
210 if [[ ${opt} == ${wxchar[0]} ]]; then
211 continue
212 else
213 wxchar[${element}]=${opt}
214 (( element++ ))
215 fi
216 done
217 ;;
218
219 debug)
220 for opt in release debug; do
221 if [[ ${opt} == ${wxdebug[0]} ]]; then
222 continue
223 else
224 wxdebug[${element}]=${opt}
225 (( element++ ))
226 fi
227 done
228 ;;
229
230 ver)
231 for opt in 2.10 2.8 2.6; do
232 if [[ ${opt} == ${wxver[0]} ]]; then
233 continue
234 else
235 wxver[${element}]=${opt}
236 (( element++ ))
237 fi
238 done
239 ;;
240 esac
241 done
242
243 # Now we iterate through the installed wx-configs and find the closest match
244 # ( debug > char > toolkit > ver )
245
246 local d c t v checkconf foundconf
247
248 for (( v = 0 ; v < ${#wxver[@]} ; v++ )); do
249 for (( t = 0 ; t < ${#wxtoolkit[@]} ; t++ )); do
250 for (( c = 0 ; c < ${#wxchar[@]} ; c++ )); do
251 for (( d = 0 ; d < ${#wxdebug[@]} ; d++ )); do
252 checkconf="${wxtoolkit[$t]}-${wxchar[$c]}-${wxdebug[$d]}-${wxver[$v]}"
253 [[ -e ${WXCONFDIR}/${checkconf} ]] || continue
254 foundconf=${checkconf}
255 break 4
256 done
257 done
258 done
259 done
260
261 [[ -z ${foundconf} ]] && foundconf="none"
262
263 echo
264 write_warning_msg "Your currently selected wxWidgets profile: ( ${currconf} )"
265 write_warning_msg "is no longer available."
266 write_warning_msg
267 write_warning_msg "The closest matching profile: ( ${foundconf} )"
268 write_warning_msg "will be activated in its place."
269
270 do_set ${foundconf}
271 }
272
273
274
275 1.1 app-admin/eselect-wxwidgets/files/wx-config-0.5
276
277 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wx-config-0.5?rev=1.1&view=markup
278 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/eselect-wxwidgets/files/wx-config-0.5?rev=1.1&content-type=text/plain
279
280 Index: wx-config-0.5
281 ===================================================================
282 #!/bin/bash -
283 #
284 # /usr/bin/wx-config
285 #
286 # a lame wx-config wrapper by dirtyepic@g.o
287
288 _wxerror() {
289 echo
290 echo "Cannot find the currently selected wxWidgets profile."
291 echo
292 echo "Please use \`eselect wxwidgets\` to select an available profile and try again."
293 echo
294 exit 1
295 }
296
297 if [[ -n ${WX_ECLASS_CONFIG} ]]; then
298 ${WX_ECLASS_CONFIG} $@
299 exit 0
300 else
301 if [[ -e /var/lib/wxwidgets/current ]]; then
302 source /var/lib/wxwidgets/current
303 else
304 _wxerror
305 fi
306
307 if [[ -f /usr/lib/wx/config/${WXCONFIG} \
308 && -x /usr/lib/wx/config/${WXCONFIG} ]]; then
309 /usr/lib/wx/config/${WXCONFIG} $@
310 else
311 _wxerror
312 fi
313 exit 0
314 fi
315
316
317
318
319 --
320 gentoo-commits@g.o mailing list