/[gentoo-x86]/eclass/python-r1.eclass
Gentoo

Contents of /eclass/python-r1.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.40 - (show annotations) (download)
Wed Jan 30 10:42:25 2013 UTC (19 months, 3 weeks ago) by mgorny
Branch: MAIN
Changes since 1.39: +4 -4 lines
Use (-) USE-defaults to reduce issues from removing flags.

1 # Copyright 1999-2013 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/python-r1.eclass,v 1.39 2013/01/27 16:40:15 mgorny Exp $
4
5 # @ECLASS: python-r1
6 # @MAINTAINER:
7 # Python team <python@gentoo.org>
8 # @AUTHOR:
9 # Author: Michał Górny <mgorny@gentoo.org>
10 # Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
11 # @BLURB: A common, simple eclass for Python packages.
12 # @DESCRIPTION:
13 # A common eclass providing helper functions to build and install
14 # packages supporting being installed for multiple Python
15 # implementations.
16 #
17 # This eclass sets correct IUSE and REQUIRED_USE. It exports PYTHON_DEPS
18 # and PYTHON_USEDEP so you can create correct dependencies for your
19 # package easily. It also provides methods to easily run a command for
20 # each enabled Python implementation and duplicate the sources for them.
21 #
22 # Please note that python-r1 will always inherit python-utils-r1 as
23 # well. Thus, all the functions defined there can be used
24 # in the packages using python-r1, and there is no need ever to inherit
25 # both.
26 #
27 # For more information, please see the python-r1 Developer's Guide:
28 # http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
29
30 case "${EAPI:-0}" in
31 0|1|2|3|4)
32 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
33 ;;
34 5)
35 # EAPI=5 is required for meaningful USE default deps
36 # on USE_EXPAND flags
37 ;;
38 *)
39 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
40 ;;
41 esac
42
43 if [[ ! ${_PYTHON_R1} ]]; then
44
45 if [[ ${_PYTHON_SINGLE_R1} ]]; then
46 die 'python-r1.eclass can not be used with python-single-r1.eclass.'
47 elif [[ ${_PYTHON_ANY_R1} ]]; then
48 die 'python-r1.eclass can not be used with python-any-r1.eclass.'
49 fi
50
51 inherit python-utils-r1
52
53 # @ECLASS-VARIABLE: PYTHON_COMPAT
54 # @REQUIRED
55 # @DESCRIPTION:
56 # This variable contains a list of Python implementations the package
57 # supports. It must be set before the `inherit' call. It has to be
58 # an array.
59 #
60 # Example:
61 # @CODE
62 # PYTHON_COMPAT=( python2_5 python2_6 python2_7 )
63 # @CODE
64 #
65 # Please note that you can also use bash brace expansion if you like:
66 # @CODE
67 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
68 # @CODE
69 if ! declare -p PYTHON_COMPAT &>/dev/null; then
70 if [[ ${CATEGORY}/${PN} == dev-python/python-exec ]]; then
71 PYTHON_COMPAT=( "${_PYTHON_ALL_IMPLS[@]}" )
72 else
73 die 'PYTHON_COMPAT not declared.'
74 fi
75 fi
76
77 # @ECLASS-VARIABLE: PYTHON_REQ_USE
78 # @DEFAULT_UNSET
79 # @DESCRIPTION:
80 # The list of USEflags required to be enabled on the chosen Python
81 # implementations, formed as a USE-dependency string. It should be valid
82 # for all implementations in PYTHON_COMPAT, so it may be necessary to
83 # use USE defaults.
84 #
85 # Example:
86 # @CODE
87 # PYTHON_REQ_USE="gdbm,ncurses(-)?"
88 # @CODE
89 #
90 # It will cause the Python dependencies to look like:
91 # @CODE
92 # python_targets_pythonX_Y? ( dev-lang/python:X.Y[gdbm,ncurses(-)?] )
93 # @CODE
94
95 # @ECLASS-VARIABLE: PYTHON_DEPS
96 # @DESCRIPTION:
97 # This is an eclass-generated Python dependency string for all
98 # implementations listed in PYTHON_COMPAT.
99 #
100 # Example use:
101 # @CODE
102 # RDEPEND="${PYTHON_DEPS}
103 # dev-foo/mydep"
104 # DEPEND="${RDEPEND}"
105 # @CODE
106 #
107 # Example value:
108 # @CODE
109 # dev-python/python-exec
110 # python_targets_python2_6? ( dev-lang/python:2.6[gdbm] )
111 # python_targets_python2_7? ( dev-lang/python:2.7[gdbm] )
112 # @CODE
113
114 # @ECLASS-VARIABLE: PYTHON_USEDEP
115 # @DESCRIPTION:
116 # This is an eclass-generated USE-dependency string which can be used to
117 # depend on another Python package being built for the same Python
118 # implementations.
119 #
120 # The generate USE-flag list is compatible with packages using python-r1
121 # and python-distutils-ng eclasses. It must not be used on packages
122 # using python.eclass.
123 #
124 # Example use:
125 # @CODE
126 # RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
127 # @CODE
128 #
129 # Example value:
130 # @CODE
131 # python_targets_python2_6(-)?,python_targets_python2_7(-)?
132 # @CODE
133
134 _python_set_globals() {
135 local impls=()
136
137 PYTHON_DEPS=
138 local i PYTHON_PKG_DEP
139 for i in "${PYTHON_COMPAT[@]}"; do
140 _python_impl_supported "${i}" || continue
141
142 python_export "${i}" PYTHON_PKG_DEP
143 PYTHON_DEPS+="python_targets_${i}? ( ${PYTHON_PKG_DEP} ) "
144
145 impls+=( "${i}" )
146 done
147
148 if [[ ${#impls[@]} -eq 0 ]]; then
149 die "No supported implementation in PYTHON_COMPAT."
150 fi
151
152 local flags=( "${impls[@]/#/python_targets_}" )
153 local optflags=${flags[@]/%/(-)?}
154
155 # A nice QA trick here. Since a python-single-r1 package has to have
156 # at least one PYTHON_SINGLE_TARGET enabled (REQUIRED_USE),
157 # the following check will always fail on those packages. Therefore,
158 # it should prevent developers from mistakenly depending on packages
159 # not supporting multiple Python implementations.
160
161 local flags_st=( "${impls[@]/#/-python_single_target_}" )
162 optflags+=,${flags_st[@]/%/(-)}
163
164 IUSE=${flags[*]}
165 #REQUIRED_USE="|| ( ${flags[*]} )"
166 PYTHON_USEDEP=${optflags// /,}
167
168 # 1) well, python-exec would suffice as an RDEP
169 # but no point in making this overcomplex, BDEP doesn't hurt anyone
170 # 2) python-exec should be built with all targets forced anyway
171 # but if new targets were added, we may need to force a rebuild
172 PYTHON_DEPS+="dev-python/python-exec[${PYTHON_USEDEP}]"
173 }
174 _python_set_globals
175
176 # @FUNCTION: _python_validate_useflags
177 # @INTERNAL
178 # @DESCRIPTION:
179 # Enforce the proper setting of PYTHON_TARGETS.
180 _python_validate_useflags() {
181 debug-print-function ${FUNCNAME} "${@}"
182
183 local i
184
185 for i in "${PYTHON_COMPAT[@]}"; do
186 _python_impl_supported "${i}" || continue
187
188 use "python_targets_${i}" && return 0
189 done
190
191 eerror "No Python implementation selected for the build. Please add one"
192 eerror "of the following values to your PYTHON_TARGETS (in make.conf):"
193 eerror
194 eerror "${PYTHON_COMPAT[@]}"
195 echo
196 die "No supported Python implementation in PYTHON_TARGETS."
197 }
198
199 # @FUNCTION: python_gen_usedep
200 # @USAGE: <pattern> [...]
201 # @DESCRIPTION:
202 # Output a USE dependency string for Python implementations which
203 # are both in PYTHON_COMPAT and match any of the patterns passed
204 # as parameters to the function.
205 #
206 # When all implementations are requested, please use ${PYTHON_USEDEP}
207 # instead. Please also remember to set an appropriate REQUIRED_USE
208 # to avoid ineffective USE flags.
209 #
210 # Example:
211 # @CODE
212 # PYTHON_COMPAT=( python{2_7,3_2} )
213 # DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep python2*)] )"
214 # @CODE
215 #
216 # It will cause the dependency to look like:
217 # @CODE
218 # DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7?] )"
219 # @CODE
220 python_gen_usedep() {
221 debug-print-function ${FUNCNAME} "${@}"
222
223 local impl pattern
224 local matches=()
225
226 for impl in "${PYTHON_COMPAT[@]}"; do
227 _python_impl_supported "${impl}" || continue
228
229 for pattern; do
230 if [[ ${impl} == ${pattern} ]]; then
231 matches+=(
232 "python_targets_${impl}(-)?"
233 "-python_single_target_${impl}(-)"
234 )
235 break
236 fi
237 done
238 done
239
240 local out=${matches[@]}
241 echo ${out// /,}
242 }
243
244 # @FUNCTION: python_gen_useflags
245 # @USAGE: <pattern> [...]
246 # @DESCRIPTION:
247 # Output a list of USE flags for Python implementations which
248 # are both in PYTHON_COMPAT and match any of the patterns passed
249 # as parameters to the function.
250 #
251 # Example:
252 # @CODE
253 # PYTHON_COMPAT=( python{2_7,3_2} )
254 # REQUIRED_USE="doc? ( || ( $(python_gen_useflags python2*) ) )"
255 # @CODE
256 #
257 # It will cause the variable to look like:
258 # @CODE
259 # REQUIRED_USE="doc? ( || ( python_targets_python2_7 ) )"
260 # @CODE
261 python_gen_useflags() {
262 debug-print-function ${FUNCNAME} "${@}"
263
264 local impl pattern
265 local matches=()
266
267 for impl in "${PYTHON_COMPAT[@]}"; do
268 _python_impl_supported "${impl}" || continue
269
270 for pattern; do
271 if [[ ${impl} == ${pattern} ]]; then
272 matches+=( "python_targets_${impl}" )
273 break
274 fi
275 done
276 done
277
278 echo ${matches[@]}
279 }
280
281 # @FUNCTION: python_gen_cond_dep
282 # @USAGE: <dependency> <pattern> [...]
283 # @DESCRIPTION:
284 # Output a list of <dependency>-ies made conditional to USE flags
285 # of Python implementations which are both in PYTHON_COMPAT and match
286 # any of the patterns passed as the remaining parameters.
287 #
288 # Please note that USE constraints on the package need to be enforced
289 # separately. Therefore, the dependency usually needs to use
290 # python_gen_usedep as well.
291 #
292 # Example:
293 # @CODE
294 # PYTHON_COMPAT=( python{2_5,2_6,2_7} )
295 # RDEPEND="$(python_gen_cond_dep dev-python/unittest2 python{2_5,2_6})"
296 # @CODE
297 #
298 # It will cause the variable to look like:
299 # @CODE
300 # RDEPEND="python_targets_python2_5? ( dev-python/unittest2 )
301 # python_targets_python2_6? ( dev-python/unittest2 )"
302 # @CODE
303 python_gen_cond_dep() {
304 debug-print-function ${FUNCNAME} "${@}"
305
306 local impl pattern
307 local matches=()
308
309 local dep=${1}
310 shift
311
312 for impl in "${PYTHON_COMPAT[@]}"; do
313 _python_impl_supported "${impl}" || continue
314
315 for pattern; do
316 if [[ ${impl} == ${pattern} ]]; then
317 matches+=( "python_targets_${impl}? ( ${dep} )" )
318 break
319 fi
320 done
321 done
322
323 echo ${matches[@]}
324 }
325
326 # @ECLASS-VARIABLE: BUILD_DIR
327 # @DESCRIPTION:
328 # The current build directory. In global scope, it is supposed to
329 # contain an initial build directory; if unset, it defaults to ${S}.
330 #
331 # In functions run by python_foreach_impl(), the BUILD_DIR is locally
332 # set to an implementation-specific build directory. That path is
333 # created through appending a hyphen and the implementation name
334 # to the final component of the initial BUILD_DIR.
335 #
336 # Example value:
337 # @CODE
338 # ${WORKDIR}/foo-1.3-python2_6
339 # @CODE
340
341 # @FUNCTION: python_copy_sources
342 # @DESCRIPTION:
343 # Create a single copy of the package sources (${S}) for each enabled
344 # Python implementation.
345 #
346 # The sources are always copied from S to implementation-specific build
347 # directories respecting BUILD_DIR.
348 python_copy_sources() {
349 debug-print-function ${FUNCNAME} "${@}"
350
351 _python_validate_useflags
352
353 local impl
354 local bdir=${BUILD_DIR:-${S}}
355
356 debug-print "${FUNCNAME}: bdir = ${bdir}"
357 einfo "Will copy sources from ${S}"
358 # the order is irrelevant here
359 for impl in "${PYTHON_COMPAT[@]}"; do
360 _python_impl_supported "${impl}" || continue
361
362 if use "python_targets_${impl}"
363 then
364 local BUILD_DIR=${bdir%%/}-${impl}
365
366 einfo "${impl}: copying to ${BUILD_DIR}"
367 debug-print "${FUNCNAME}: [${impl}] cp ${S} => ${BUILD_DIR}"
368 cp -pr "${S}" "${BUILD_DIR}" || die
369 fi
370 done
371 }
372
373 # @FUNCTION: _python_check_USE_PYTHON
374 # @INTERNAL
375 # @DESCRIPTION:
376 # Check whether USE_PYTHON and PYTHON_TARGETS are in sync. Output
377 # warnings if they are not.
378 _python_check_USE_PYTHON() {
379 debug-print-function ${FUNCNAME} "${@}"
380
381 if [[ ! ${_PYTHON_USE_PYTHON_CHECKED} ]]; then
382 _PYTHON_USE_PYTHON_CHECKED=1
383
384 # python-exec has profile-forced flags.
385 if [[ ${CATEGORY}/${PN} == dev-python/python-exec ]]; then
386 return
387 fi
388
389 _try_eselect() {
390 # The eselect solution will work only with one py2 & py3.
391
392 local impl py2 py3 dis_py2 dis_py3
393 for impl in "${PYTHON_COMPAT[@]}"; do
394 _python_impl_supported "${impl}" || continue
395
396 if use "python_targets_${impl}"; then
397 case "${impl}" in
398 python2_*)
399 if [[ ${py2+1} ]]; then
400 debug-print "${FUNCNAME}: -> more than one py2: ${py2} ${impl}"
401 return 1
402 fi
403 py2=${impl/_/.}
404 ;;
405 python3_*)
406 if [[ ${py3+1} ]]; then
407 debug-print "${FUNCNAME}: -> more than one py3: ${py3} ${impl}"
408 return 1
409 fi
410 py3=${impl/_/.}
411 ;;
412 *)
413 return 1
414 ;;
415 esac
416 else
417 case "${impl}" in
418 python2_*)
419 dis_py2=1
420 ;;
421 python3_*)
422 dis_py3=1
423 ;;
424 esac
425 fi
426 done
427
428 # The eselect solution won't work if the disabled Python version
429 # is installed.
430 if [[ ! ${py2+1} && ${dis_py2} ]]; then
431 debug-print "${FUNCNAME}: -> all py2 versions disabled"
432 if ! has python2_7 "${PYTHON_COMPAT[@]}"; then
433 debug-print "${FUNCNAME}: ---> package does not support 2.7"
434 return 0
435 fi
436 if has_version '=dev-lang/python-2*'; then
437 debug-print "${FUNCNAME}: ---> but =python-2* installed!"
438 return 1
439 fi
440 fi
441 if [[ ! ${py3+1} && ${dis_py3} ]]; then
442 debug-print "${FUNCNAME}: -> all py3 versions disabled"
443 if ! has python3_2 "${PYTHON_COMPAT[@]}"; then
444 debug-print "${FUNCNAME}: ---> package does not support 3.2"
445 return 0
446 fi
447 if has_version '=dev-lang/python-3*'; then
448 debug-print "${FUNCNAME}: ---> but =python-3* installed!"
449 return 1
450 fi
451 fi
452
453 local warned
454
455 # Now check whether the correct implementations are active.
456 if [[ ${py2+1} ]]; then
457 local sel_py2=$(eselect python show --python2)
458
459 debug-print "${FUNCNAME}: -> py2 built: ${py2}, active: ${sel_py2}"
460 if [[ ${py2} != ${sel_py2} ]]; then
461 ewarn "Building package for ${py2} only while ${sel_py2} is active."
462 ewarn "Please consider switching the active Python 2 interpreter:"
463 ewarn
464 ewarn " eselect python set --python2 ${py2}"
465 warned=1
466 fi
467 fi
468
469 if [[ ${py3+1} ]]; then
470 local sel_py3=$(eselect python show --python3)
471
472 debug-print "${FUNCNAME}: -> py3 built: ${py3}, active: ${sel_py3}"
473 if [[ ${py3} != ${sel_py3} ]]; then
474 [[ ${warned} ]] && ewarn
475 ewarn "Building package for ${py3} only while ${sel_py3} is active."
476 ewarn "Please consider switching the active Python 3 interpreter:"
477 ewarn
478 ewarn " eselect python set --python3 ${py3}"
479 warned=1
480 fi
481 fi
482
483 if [[ ${warned} ]]; then
484 ewarn
485 ewarn "Please note that after switching the active Python interpreter,"
486 ewarn "you may need to run 'python-updater' to rebuild affected packages."
487 ewarn
488 ewarn "For more information on python.eclass compatibility, please see"
489 ewarn "the appropriate python-r1 User's Guide chapter [1]."
490 ewarn
491 ewarn "[1] http://www.gentoo.org/proj/en/Python/python-r1/user-guide.xml#doc_chap2"
492 fi
493 }
494
495 # If user has no USE_PYTHON, try to avoid it.
496 if [[ ! ${USE_PYTHON} ]]; then
497 debug-print "${FUNCNAME}: trying eselect solution ..."
498 _try_eselect && return
499 fi
500
501 debug-print "${FUNCNAME}: trying USE_PYTHON solution ..."
502 debug-print "${FUNCNAME}: -> USE_PYTHON=${USE_PYTHON}"
503
504 local impl old=${USE_PYTHON} new=() removed=()
505
506 for impl in "${PYTHON_COMPAT[@]}"; do
507 _python_impl_supported "${impl}" || continue
508
509 local abi
510 case "${impl}" in
511 python*)
512 abi=${impl#python}
513 ;;
514 jython*)
515 abi=${impl#jython}-jython
516 ;;
517 pypy*)
518 abi=2.7-pypy-${impl#pypy}
519 ;;
520 *)
521 die "Unexpected Python implementation: ${impl}"
522 ;;
523 esac
524 abi=${abi/_/.}
525
526 has "${abi}" ${USE_PYTHON}
527 local has_abi=${?}
528 use "python_targets_${impl}"
529 local has_impl=${?}
530
531 # 0 = has, 1 = does not have
532 if [[ ${has_abi} == 0 && ${has_impl} == 1 ]]; then
533 debug-print "${FUNCNAME}: ---> remove ${abi}"
534 # remove from USE_PYTHON
535 old=${old/${abi}/}
536 removed+=( ${abi} )
537 elif [[ ${has_abi} == 1 && ${has_impl} == 0 ]]; then
538 debug-print "${FUNCNAME}: ---> add ${abi}"
539 # add to USE_PYTHON
540 new+=( ${abi} )
541 fi
542 done
543
544 if [[ ${removed[@]} || ${new[@]} ]]; then
545 old=( ${old} )
546
547 debug-print "${FUNCNAME}: -> old: ${old[@]}"
548 debug-print "${FUNCNAME}: -> new: ${new[@]}"
549 debug-print "${FUNCNAME}: -> removed: ${removed[@]}"
550
551 if [[ ${USE_PYTHON} ]]; then
552 ewarn "It seems that your USE_PYTHON setting lists different Python"
553 ewarn "implementations than your PYTHON_TARGETS variable. Please consider"
554 ewarn "using the following value instead:"
555 ewarn
556 ewarn " USE_PYTHON='\033[35m${old[@]}${new[@]+ \033[1m${new[@]}}\033[0m'"
557
558 if [[ ${removed[@]} ]]; then
559 ewarn
560 ewarn "(removed \033[31m${removed[@]}\033[0m)"
561 fi
562 else
563 ewarn "It seems that you need to set USE_PYTHON to make sure that legacy"
564 ewarn "packages will be built with respect to PYTHON_TARGETS correctly:"
565 ewarn
566 ewarn " USE_PYTHON='\033[35;1m${new[@]}\033[0m'"
567 fi
568
569 ewarn
570 ewarn "Please note that after changing the USE_PYTHON variable, you may need"
571 ewarn "to run 'python-updater' to rebuild affected packages."
572 ewarn
573 ewarn "For more information on python.eclass compatibility, please see"
574 ewarn "the appropriate python-r1 User's Guide chapter [1]."
575 ewarn
576 ewarn "[1] http://www.gentoo.org/proj/en/Python/python-r1/user-guide.xml#doc_chap2"
577 fi
578 fi
579 }
580
581 # @FUNCTION: python_foreach_impl
582 # @USAGE: <command> [<args>...]
583 # @DESCRIPTION:
584 # Run the given command for each of the enabled Python implementations.
585 # If additional parameters are passed, they will be passed through
586 # to the command. If the command fails, python_foreach_impl dies.
587 # If necessary, use ':' to force a successful return.
588 #
589 # For each command being run, EPYTHON, PYTHON and BUILD_DIR are set
590 # locally, and the former two are exported to the command environment.
591 python_foreach_impl() {
592 debug-print-function ${FUNCNAME} "${@}"
593
594 _python_validate_useflags
595 _python_check_USE_PYTHON
596
597 local impl
598 local bdir=${BUILD_DIR:-${S}}
599
600 debug-print "${FUNCNAME}: bdir = ${bdir}"
601 for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
602 if has "${impl}" "${PYTHON_COMPAT[@]}" \
603 && _python_impl_supported "${impl}" \
604 && use "python_targets_${impl}"
605 then
606 local EPYTHON PYTHON
607 python_export "${impl}" EPYTHON PYTHON
608 local BUILD_DIR=${bdir%%/}-${impl}
609 export EPYTHON PYTHON
610
611 einfo "${EPYTHON}: running ${@}"
612 "${@}" || die "${EPYTHON}: ${1} failed"
613 fi
614 done
615 }
616
617 # @FUNCTION: python_export_best
618 # @USAGE: [<variable>...]
619 # @DESCRIPTION:
620 # Find the best (most preferred) Python implementation enabled
621 # and export given variables for it. If no variables are provided,
622 # EPYTHON & PYTHON will be exported.
623 python_export_best() {
624 debug-print-function ${FUNCNAME} "${@}"
625
626 _python_validate_useflags
627
628 [[ ${#} -gt 0 ]] || set -- EPYTHON PYTHON
629
630 local impl best
631 for impl in "${_PYTHON_ALL_IMPLS[@]}"; do
632 if has "${impl}" "${PYTHON_COMPAT[@]}" \
633 && _python_impl_supported "${impl}" \
634 && use "python_targets_${impl}"
635 then
636 best=${impl}
637 fi
638 done
639
640 [[ ${best+1} ]] || die "python_export_best(): no implementation found!"
641
642 debug-print "${FUNCNAME}: Best implementation is: ${impl}"
643 python_export "${impl}" "${@}"
644 }
645
646 # @FUNCTION: python_replicate_script
647 # @USAGE: <path>...
648 # @DESCRIPTION:
649 # Copy the given script to variants for all enabled Python
650 # implementations, then replace it with a symlink to the wrapper.
651 #
652 # All specified files must start with a 'python' shebang. A file not
653 # having a matching shebang will be refused.
654 python_replicate_script() {
655 debug-print-function ${FUNCNAME} "${@}"
656
657 _python_validate_useflags
658
659 local suffixes=()
660
661 _add_suffix() {
662 suffixes+=( "${EPYTHON}" )
663 }
664 python_foreach_impl _add_suffix
665 debug-print "${FUNCNAME}: suffixes = ( ${suffixes[@]} )"
666
667 local f suffix
668 for suffix in "${suffixes[@]}"; do
669 for f; do
670 local newf=${f}-${suffix}
671
672 debug-print "${FUNCNAME}: ${f} -> ${newf}"
673 cp "${f}" "${newf}" || die
674 done
675
676 _python_rewrite_shebang "${suffix}" "${@/%/-${suffix}}"
677 done
678
679 for f; do
680 _python_ln_rel "${ED}"/usr/bin/python-exec "${f}" || die
681 done
682 }
683
684 # @FUNCTION: run_in_build_dir
685 # @USAGE: <argv>...
686 # @DESCRIPTION:
687 # Run the given command in the directory pointed by BUILD_DIR.
688 run_in_build_dir() {
689 debug-print-function ${FUNCNAME} "${@}"
690 local ret
691
692 [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
693 [[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
694
695 pushd "${BUILD_DIR}" >/dev/null || die
696 "${@}"
697 ret=${?}
698 popd >/dev/null || die
699
700 return ${ret}
701 }
702
703 _PYTHON_R1=1
704 fi

  ViewVC Help
Powered by ViewVC 1.1.20