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

Contents of /eclass/distutils-r1.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.94 - (show annotations) (download)
Sat Jan 18 15:06:56 2014 UTC (8 months ago) by floppym
Branch: MAIN
Changes since 1.93: +3 -2 lines
Silence sandbox for /usr/local, bug 498232.

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.93 2013/12/03 20:00:39 floppym Exp $
4
5 # @ECLASS: distutils-r1
6 # @MAINTAINER:
7 # Python team <python@gentoo.org>
8 # @AUTHOR:
9 # Author: Michał Górny <mgorny@gentoo.org>
10 # Based on the work of: Krzysztof Pawlik <nelchael@gentoo.org>
11 # @BLURB: A simple eclass to build Python packages using distutils.
12 # @DESCRIPTION:
13 # A simple eclass providing functions to build Python packages using
14 # the distutils build system. It exports phase functions for all
15 # the src_* phases. Each of the phases runs two pseudo-phases:
16 # python_..._all() (e.g. python_prepare_all()) once in ${S}, then
17 # python_...() (e.g. python_prepare()) for each implementation
18 # (see: python_foreach_impl() in python-r1).
19 #
20 # In distutils-r1_src_prepare(), the 'all' function is run before
21 # per-implementation ones (because it creates the implementations),
22 # per-implementation functions are run in a random order.
23 #
24 # In remaining phase functions, the per-implementation functions are run
25 # before the 'all' one, and they are ordered from the least to the most
26 # preferred implementation (so that 'better' files overwrite 'worse'
27 # ones).
28 #
29 # If the ebuild doesn't specify a particular pseudo-phase function,
30 # the default one will be used (distutils-r1_...). Defaults are provided
31 # for all per-implementation pseudo-phases, python_prepare_all()
32 # and python_install_all(); whenever writing your own pseudo-phase
33 # functions, you should consider calling the defaults (and especially
34 # distutils-r1_python_prepare_all).
35 #
36 # Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally
37 # for you.
38 #
39 # Also, please note that distutils-r1 will always inherit python-r1
40 # as well. Thus, all the variables defined and documented there are
41 # relevant to the packages using distutils-r1.
42 #
43 # For more information, please see the python-r1 Developer's Guide:
44 # http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
45
46 case "${EAPI:-0}" in
47 0|1|2|3)
48 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
49 ;;
50 4|5)
51 ;;
52 *)
53 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
54 ;;
55 esac
56
57 # @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
58 # @DEFAULT_UNSET
59 # @DESCRIPTION:
60 # If set to a non-null value, distutils part in the ebuild will
61 # be considered optional. No dependencies will be added and no phase
62 # functions will be exported.
63 #
64 # If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
65 # for your package (using ${PYTHON_DEPS}) and to either call
66 # distutils-r1 default phase functions or call the build system
67 # manually.
68
69 # @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
70 # @DEFAULT_UNSET
71 # @DESCRIPTION:
72 # If set to a non-null value, the ebuild will support setting a single
73 # Python implementation only. It will effectively replace the python-r1
74 # eclass inherit with python-single-r1.
75 #
76 # Note that inheriting python-single-r1 will cause pkg_setup()
77 # to be exported. It must be run in order for the eclass functions
78 # to function properly.
79
80 if [[ ! ${_DISTUTILS_R1} ]]; then
81
82 inherit eutils
83
84 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
85 inherit multiprocessing python-r1
86 else
87 inherit python-single-r1
88 fi
89
90 fi
91
92 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
93 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
94 fi
95
96 if [[ ! ${_DISTUTILS_R1} ]]; then
97
98 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
99 RDEPEND=${PYTHON_DEPS}
100 DEPEND=${PYTHON_DEPS}
101 REQUIRED_USE=${PYTHON_REQUIRED_USE}
102 fi
103
104 # @ECLASS-VARIABLE: PATCHES
105 # @DEFAULT_UNSET
106 # @DESCRIPTION:
107 # An array containing patches to be applied to the sources before
108 # copying them.
109 #
110 # If unset, no custom patches will be applied.
111 #
112 # Please note, however, that at some point the eclass may apply
113 # additional distutils patches/quirks independently of this variable.
114 #
115 # Example:
116 # @CODE
117 # PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch )
118 # @CODE
119
120 # @ECLASS-VARIABLE: DOCS
121 # @DEFAULT_UNSET
122 # @DESCRIPTION:
123 # An array containing documents installed using dodoc. The files listed
124 # there must exist in the directory from which
125 # distutils-r1_python_install_all() is run (${S} by default).
126 #
127 # If unset, the function will instead look up files matching default
128 # filename pattern list (from the Package Manager Specification),
129 # and install those found.
130 #
131 # Example:
132 # @CODE
133 # DOCS=( NEWS README )
134 # @CODE
135
136 # @ECLASS-VARIABLE: HTML_DOCS
137 # @DEFAULT_UNSET
138 # @DESCRIPTION:
139 # An array containing documents installed using dohtml. The files
140 # and directories listed there must exist in the directory from which
141 # distutils-r1_python_install_all() is run (${S} by default).
142 #
143 # If unset, no HTML docs will be installed.
144 #
145 # Example:
146 # @CODE
147 # HTML_DOCS=( doc/html/. )
148 # @CODE
149
150 # @ECLASS-VARIABLE: EXAMPLES
151 # @DEFAULT_UNSET
152 # @DESCRIPTION:
153 # An array containing examples installed into 'examples' doc
154 # subdirectory. The files and directories listed there must exist
155 # in the directory from which distutils-r1_python_install_all() is run
156 # (${S} by default).
157 #
158 # The 'examples' subdirectory will be marked not to be compressed
159 # automatically.
160 #
161 # If unset, no examples will be installed.
162 #
163 # Example:
164 # @CODE
165 # EXAMPLES=( examples/. demos/. )
166 # @CODE
167
168 # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
169 # @DEFAULT_UNSET
170 # @DESCRIPTION:
171 # If set to a non-null value, in-source builds will be enabled.
172 # If unset, the default is to use in-source builds when python_prepare()
173 # is declared, and out-of-source builds otherwise.
174 #
175 # If in-source builds are used, the eclass will create a copy of package
176 # sources for each Python implementation in python_prepare_all(),
177 # and work on that copy afterwards.
178 #
179 # If out-of-source builds are used, the eclass will instead work
180 # on the sources directly, prepending setup.py arguments with
181 # 'build --build-base ${BUILD_DIR}' to enforce keeping & using built
182 # files in the specific root.
183
184 # @ECLASS-VARIABLE: DISTUTILS_NO_PARALLEL_BUILD
185 # @DEFAULT_UNSET
186 # @DESCRIPTION:
187 # If set to a non-null value, the parallel build feature will
188 # be disabled.
189 #
190 # When parallel builds are used, the implementation-specific sub-phases
191 # for selected Python implementation will be run in parallel. This will
192 # increase build efficiency with distutils which does not do parallel
193 # builds.
194 #
195 # This variable can be used to disable the afore-mentioned feature
196 # in case it causes issues with the package.
197
198 # @ECLASS-VARIABLE: mydistutilsargs
199 # @DEFAULT_UNSET
200 # @DESCRIPTION:
201 # An array containing options to be passed to setup.py.
202 #
203 # Example:
204 # @CODE
205 # python_configure_all() {
206 # mydistutilsargs=( --enable-my-hidden-option )
207 # }
208 # @CODE
209
210 # @FUNCTION: esetup.py
211 # @USAGE: [<args>...]
212 # @DESCRIPTION:
213 # Run setup.py using currently selected Python interpreter
214 # (if ${PYTHON} is set; fallback 'python' otherwise).
215 #
216 # setup.py will be passed the following, in order:
217 # 1. ${mydistutilsargs[@]}
218 # 2. additional arguments passed to the esetup.py function.
219 #
220 # This command dies on failure.
221 esetup.py() {
222 debug-print-function ${FUNCNAME} "${@}"
223
224 set -- "${PYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
225
226 echo "${@}" >&2
227 "${@}" || die
228 }
229
230 # @FUNCTION: distutils_install_for_testing
231 # @USAGE: [<args>...]
232 # @DESCRIPTION:
233 # Install the package into a temporary location for running tests.
234 # Update PYTHONPATH appropriately and set TEST_DIR to the test
235 # installation root. The Python packages will be installed in 'lib'
236 # subdir, and scripts in 'scripts' subdir (like in BUILD_DIR).
237 #
238 # Please note that this function should be only used if package uses
239 # namespaces (and therefore proper install needs to be done to enforce
240 # PYTHONPATH) or tests rely on the results of install command.
241 # For most of the packages, tests built in BUILD_DIR are good enough.
242 distutils_install_for_testing() {
243 debug-print-function ${FUNCNAME} "${@}"
244
245 # A few notes:
246 # 1) because of namespaces, we can't use 'install --root',
247 # 2) 'install --home' is terribly broken on pypy, so we need
248 # to override --install-lib and --install-scripts,
249 # 3) non-root 'install' complains about PYTHONPATH and missing dirs,
250 # so we need to set it properly and mkdir them,
251 # 4) it runs a bunch of commands which write random files to cwd,
252 # in order to avoid that, we add the necessary path overrides
253 # in _distutils-r1_create_setup_cfg.
254
255 TEST_DIR=${BUILD_DIR}/test
256 local bindir=${TEST_DIR}/scripts
257 local libdir=${TEST_DIR}/lib
258 PYTHONPATH=${libdir}:${PYTHONPATH}
259
260 local add_args=(
261 install
262 --home="${TEST_DIR}"
263 --install-lib="${libdir}"
264 --install-scripts="${bindir}"
265 )
266
267 mkdir -p "${libdir}" || die
268 esetup.py "${add_args[@]}" "${@}"
269 }
270
271 # @FUNCTION: _distutils-r1_disable_ez_setup
272 # @INTERNAL
273 # @DESCRIPTION:
274 # Stub out ez_setup.py and distribute_setup.py to prevent packages
275 # from trying to download a local copy of setuptools.
276 _distutils-r1_disable_ez_setup() {
277 local stub="def use_setuptools(*args, **kwargs): pass"
278 if [[ -f ez_setup.py ]]; then
279 echo "${stub}" > ez_setup.py || die
280 fi
281 if [[ -f distribute_setup.py ]]; then
282 echo "${stub}" > distribute_setup.py || die
283 fi
284 }
285
286 # @FUNCTION: distutils-r1_python_prepare_all
287 # @DESCRIPTION:
288 # The default python_prepare_all(). It applies the patches from PATCHES
289 # array, then user patches and finally calls python_copy_sources to
290 # create copies of resulting sources for each Python implementation.
291 #
292 # At some point in the future, it may also apply eclass-specific
293 # distutils patches and/or quirks.
294 distutils-r1_python_prepare_all() {
295 debug-print-function ${FUNCNAME} "${@}"
296
297 [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
298
299 epatch_user
300
301 # by default, use in-source build if python_prepare() is used
302 if [[ ! ${DISTUTILS_IN_SOURCE_BUILD+1} ]]; then
303 if declare -f python_prepare >/dev/null; then
304 DISTUTILS_IN_SOURCE_BUILD=1
305 fi
306 fi
307
308 _distutils-r1_disable_ez_setup
309
310 if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
311 then
312 # create source copies for each implementation
313 python_copy_sources
314 fi
315
316 _DISTUTILS_DEFAULT_CALLED=1
317 }
318
319 # @FUNCTION: distutils-r1_python_prepare
320 # @DESCRIPTION:
321 # The default python_prepare(). A no-op.
322 distutils-r1_python_prepare() {
323 debug-print-function ${FUNCNAME} "${@}"
324
325 :
326 }
327
328 # @FUNCTION: distutils-r1_python_configure
329 # @DESCRIPTION:
330 # The default python_configure(). A no-op.
331 distutils-r1_python_configure() {
332 debug-print-function ${FUNCNAME} "${@}"
333
334 :
335 }
336
337 # @FUNCTION: _distutils-r1_create_setup_cfg
338 # @INTERNAL
339 # @DESCRIPTION:
340 # Create implementation-specific configuration file for distutils,
341 # setting proper build-dir paths.
342 _distutils-r1_create_setup_cfg() {
343 cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
344 [build]
345 build-base = ${BUILD_DIR}
346
347 # using a single directory for them helps us export
348 # ${PYTHONPATH} and ebuilds find the sources independently
349 # of whether the package installs extensions or not
350 #
351 # note: due to some packages (wxpython) relying on separate
352 # platlib & purelib dirs, we do not set --build-lib (which
353 # can not be overriden with --build-*lib)
354 build-platlib = %(build-base)s/lib
355 build-purelib = %(build-base)s/lib
356
357 # make the ebuild writer lives easier
358 build-scripts = %(build-base)s/scripts
359
360 [egg_info]
361 egg-base = ${BUILD_DIR}
362
363 # this is needed by distutils_install_for_testing since
364 # setuptools like to create .egg files for install --home.
365 [bdist_egg]
366 dist-dir = ${BUILD_DIR}/dist
367 _EOF_
368 }
369
370 # @FUNCTION: _distutils-r1_copy_egg_info
371 # @INTERNAL
372 # @DESCRIPTION:
373 # Copy egg-info files to the ${BUILD_DIR} (that's going to become
374 # egg-base in esetup.py). This way, we respect whatever's in upstream
375 # egg-info.
376 _distutils-r1_copy_egg_info() {
377 mkdir -p "${BUILD_DIR}" || die
378 # stupid freebsd can't do 'cp -t ${BUILD_DIR} {} +'
379 find -name '*.egg-info' -type d -exec cp -pr {} "${BUILD_DIR}"/ ';' || die
380 }
381
382 # @FUNCTION: distutils-r1_python_compile
383 # @USAGE: [additional-args...]
384 # @DESCRIPTION:
385 # The default python_compile(). Runs 'esetup.py build'. Any parameters
386 # passed to this function will be appended to setup.py invocation,
387 # i.e. passed as options to the 'build' command.
388 distutils-r1_python_compile() {
389 debug-print-function ${FUNCNAME} "${@}"
390
391 _distutils-r1_create_setup_cfg
392 _distutils-r1_copy_egg_info
393
394 esetup.py build "${@}"
395 }
396
397 # @FUNCTION: _distutils-r1_wrap_scripts
398 # @USAGE: <path> <bindir>
399 # @INTERNAL
400 # @DESCRIPTION:
401 # Moves and wraps all installed scripts/executables as necessary.
402 _distutils-r1_wrap_scripts() {
403 debug-print-function ${FUNCNAME} "${@}"
404
405 [[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
406 local path=${1}
407 local bindir=${2}
408
409 if ! _python_want_python_exec2; then
410 local PYTHON_SCRIPTDIR=${bindir}
411 fi
412
413 local f python_files=() non_python_files=()
414
415 if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then
416 for f in "${path}${PYTHON_SCRIPTDIR}"/*; do
417 [[ -d ${f} ]] && die "Unexpected directory: ${f}"
418 debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
419
420 local shebang
421 read -r shebang < "${f}"
422 if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
423 debug-print "${FUNCNAME}: matching shebang: ${shebang}"
424 python_files+=( "${f}" )
425 elif _python_want_python_exec2; then
426 debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
427 non_python_files+=( "${f}" )
428 fi
429
430 mkdir -p "${path}${bindir}" || die
431 done
432
433 for f in "${python_files[@]}"; do
434 local basename=${f##*/}
435
436 if ! _python_want_python_exec2; then
437 local newf=${f%/*}/${basename}-${EPYTHON}
438 debug-print "${FUNCNAME}: renaming ${f#${path}/} to ${newf#${path}/}"
439 mv "${f}" "${newf}" || die
440 fi
441
442 debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
443 _python_ln_rel "${path}${EPREFIX}"$(_python_get_wrapper_path) \
444 "${path}${bindir}/${basename}" || die
445 done
446
447 # (non-empty only with python-exec:2)
448 for f in "${non_python_files[@]}"; do
449 local basename=${f##*/}
450
451 debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
452 mv "${f}" "${path}${bindir}/${basename}" || die
453 done
454 fi
455 }
456
457 # @FUNCTION: distutils-r1_python_install
458 # @USAGE: [additional-args...]
459 # @DESCRIPTION:
460 # The default python_install(). Runs 'esetup.py install', appending
461 # the optimization flags. Then renames the installed scripts.
462 # Any parameters passed to this function will be appended
463 # to the setup.py invocation (i.e. as options to the 'install' command).
464 distutils-r1_python_install() {
465 debug-print-function ${FUNCNAME} "${@}"
466
467 local args=( "${@}" )
468 local flags
469
470 case "${EPYTHON}" in
471 jython*)
472 flags=(--compile);;
473 *)
474 flags=(--compile -O2);;
475 esac
476 debug-print "${FUNCNAME}: [${EPYTHON}] flags: ${flags}"
477
478 # enable compilation for the install phase.
479 local -x PYTHONDONTWRITEBYTECODE
480
481 # python likes to compile any module it sees, which triggers sandbox
482 # failures if some packages haven't compiled their modules yet.
483 addpredict "$(python_get_sitedir)"
484 addpredict /usr/lib/portage/pym
485 addpredict /usr/local # bug 498232
486
487 local root=${D}/_${EPYTHON}
488 [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
489 flags+=( --root="${root}" )
490
491 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
492 # user may override --install-scripts
493 # note: this is poor but distutils argv parsing is dumb
494 local mydistutilsargs=( "${mydistutilsargs[@]}" )
495 local scriptdir=${EPREFIX}/usr/bin
496
497 # construct a list of mydistutilsargs[0] args[0] args[1]...
498 local arg arg_vars
499 [[ ${mydistutilsargs[@]} ]] && eval arg_vars+=(
500 'mydistutilsargs['{0..$(( ${#mydistutilsargs[@]} - 1 ))}']'
501 )
502 [[ ${args[@]} ]] && eval arg_vars+=(
503 'args['{0..$(( ${#args[@]} - 1 ))}']'
504 )
505
506 set -- "${arg_vars[@]}"
507 while [[ ${@} ]]; do
508 local arg_var=${1}
509 shift
510 local a=${!arg_var}
511
512 case "${a}" in
513 --install-scripts=*)
514 scriptdir=${a#--install-scripts=}
515 if _python_want_python_exec2; then
516 unset "${arg_var}"
517 fi
518 ;;
519 --install-scripts)
520 scriptdir=${!1}
521 if _python_want_python_exec2; then
522 unset "${arg_var}" "${1}"
523 fi
524 shift
525 ;;
526 esac
527 done
528
529 if _python_want_python_exec2; then
530 local PYTHON_SCRIPTDIR
531 python_export PYTHON_SCRIPTDIR
532 flags+=( --install-scripts="${PYTHON_SCRIPTDIR}" )
533 fi
534 fi
535
536 esetup.py install "${flags[@]}" "${args[@]}"
537
538 if [[ -d ${root}$(python_get_sitedir)/tests ]]; then
539 die "Package installs 'tests' package, file collisions likely."
540 fi
541
542 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
543 _distutils-r1_wrap_scripts "${root}" "${scriptdir}"
544 multibuild_merge_root "${root}" "${D}"
545 fi
546 }
547
548 # @FUNCTION: distutils-r1_python_install_all
549 # @DESCRIPTION:
550 # The default python_install_all(). It installs the documentation.
551 distutils-r1_python_install_all() {
552 debug-print-function ${FUNCNAME} "${@}"
553
554 einstalldocs
555
556 if declare -p EXAMPLES &>/dev/null; then
557 local INSDESTTREE=/usr/share/doc/${PF}/examples
558 doins -r "${EXAMPLES[@]}"
559 docompress -x "${INSDESTTREE}"
560 fi
561
562 _DISTUTILS_DEFAULT_CALLED=1
563 }
564
565 # @FUNCTION: distutils-r1_run_phase
566 # @USAGE: [<argv>...]
567 # @INTERNAL
568 # @DESCRIPTION:
569 # Run the given command.
570 #
571 # If out-of-source builds are used, the phase function is run in source
572 # directory, with BUILD_DIR pointing at the build directory
573 # and PYTHONPATH having an entry for the module build directory.
574 #
575 # If in-source builds are used, the command is executed in the directory
576 # holding the per-implementation copy of sources. BUILD_DIR points
577 # to the 'build' subdirectory.
578 distutils-r1_run_phase() {
579 debug-print-function ${FUNCNAME} "${@}"
580
581 if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
582 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
583 pushd "${BUILD_DIR}" >/dev/null || die
584 fi
585 local BUILD_DIR=${BUILD_DIR}/build
586 fi
587 local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
588
589 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
590 local -x TMPDIR=${T}/${EPYTHON}
591 local -x HOME=${TMPDIR}/home
592
593 mkdir -p "${TMPDIR}" "${HOME}" || die
594 fi
595
596 "${@}"
597
598 if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
599 then
600 popd >/dev/null || die
601 fi
602 }
603
604 # @FUNCTION: _distutils-r1_run_common_phase
605 # @USAGE: [<argv>...]
606 # @INTERNAL
607 # @DESCRIPTION:
608 # Run the given command, restoring the best-implementation state.
609 #
610 # If in-source build is used, the command will be run in the copy
611 # of sources made for the best Python interpreter.
612 _distutils-r1_run_common_phase() {
613 local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
614
615 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
616 local MULTIBUILD_VARIANTS
617 _python_obtain_impls
618
619 multibuild_for_best_variant _python_multibuild_wrapper \
620 distutils-r1_run_phase "${@}"
621 else
622 # semi-hack, be careful.
623 _distutils-r1_run_foreach_impl "${@}"
624 fi
625 }
626
627 # @FUNCTION: _distutils-r1_run_foreach_impl
628 # @INTERNAL
629 # @DESCRIPTION:
630 # Run the given phase for each implementation if multiple implementations
631 # are enabled, once otherwise.
632 _distutils-r1_run_foreach_impl() {
633 debug-print-function ${FUNCNAME} "${@}"
634
635 set -- distutils-r1_run_phase "${@}"
636
637 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
638 if [[ ${DISTUTILS_NO_PARALLEL_BUILD} || ${DISTUTILS_SINGLE_IMPL} ]]
639 then
640 python_foreach_impl "${@}"
641 else
642 python_parallel_foreach_impl "${@}"
643 fi
644 else
645 if [[ ! ${EPYTHON} ]]; then
646 die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
647 fi
648 local BUILD_DIR=${BUILD_DIR:-${S}}
649 BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
650
651 "${@}"
652 fi
653 }
654
655 distutils-r1_src_prepare() {
656 debug-print-function ${FUNCNAME} "${@}"
657
658 local _DISTUTILS_DEFAULT_CALLED
659
660 # common preparations
661 if declare -f python_prepare_all >/dev/null; then
662 python_prepare_all
663 else
664 distutils-r1_python_prepare_all
665 fi
666
667 if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
668 eqawarn "QA warning: python_prepare_all() didn't call distutils-r1_python_prepare_all"
669 fi
670
671 if declare -f python_prepare >/dev/null; then
672 _distutils-r1_run_foreach_impl python_prepare
673 fi
674 }
675
676 distutils-r1_src_configure() {
677 if declare -f python_configure >/dev/null; then
678 _distutils-r1_run_foreach_impl python_configure
679 fi
680
681 if declare -f python_configure_all >/dev/null; then
682 _distutils-r1_run_common_phase python_configure_all
683 fi
684 }
685
686 distutils-r1_src_compile() {
687 debug-print-function ${FUNCNAME} "${@}"
688
689 if declare -f python_compile >/dev/null; then
690 _distutils-r1_run_foreach_impl python_compile
691 else
692 _distutils-r1_run_foreach_impl distutils-r1_python_compile
693 fi
694
695 if declare -f python_compile_all >/dev/null; then
696 _distutils-r1_run_common_phase python_compile_all
697 fi
698 }
699
700 distutils-r1_src_test() {
701 debug-print-function ${FUNCNAME} "${@}"
702
703 if declare -f python_test >/dev/null; then
704 _distutils-r1_run_foreach_impl python_test
705 fi
706
707 if declare -f python_test_all >/dev/null; then
708 _distutils-r1_run_common_phase python_test_all
709 fi
710 }
711
712 distutils-r1_src_install() {
713 debug-print-function ${FUNCNAME} "${@}"
714
715 if declare -f python_install >/dev/null; then
716 _distutils-r1_run_foreach_impl python_install
717 else
718 _distutils-r1_run_foreach_impl distutils-r1_python_install
719 fi
720
721 local _DISTUTILS_DEFAULT_CALLED
722
723 if declare -f python_install_all >/dev/null; then
724 _distutils-r1_run_common_phase python_install_all
725 else
726 _distutils-r1_run_common_phase distutils-r1_python_install_all
727 fi
728
729 if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
730 eqawarn "QA warning: python_install_all() didn't call distutils-r1_python_install_all"
731 fi
732 }
733
734 _DISTUTILS_R1=1
735 fi

  ViewVC Help
Powered by ViewVC 1.1.20