1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: distutils-r1.eclass
7 # Python team <python@gentoo.org>
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.
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).
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.
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'
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).
36 # Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally
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.
43 # For more information, please see the wiki:
44 # https://wiki.gentoo.org/wiki/Project:Python/distutils-r1
48 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
53 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
57 # @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
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.
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
69 # @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
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.
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.
80 if [[ ! ${_DISTUTILS_R1} ]]; then
82 [[ ${EAPI} == [45] ]] && inherit eutils
83 inherit toolchain-funcs
85 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
86 inherit multiprocessing python-r1
88 inherit python-single-r1
93 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
94 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
97 if [[ ! ${_DISTUTILS_R1} ]]; then
99 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
100 RDEPEND=${PYTHON_DEPS}
101 DEPEND=${PYTHON_DEPS}
102 REQUIRED_USE=${PYTHON_REQUIRED_USE}
105 # @ECLASS-VARIABLE: PATCHES
108 # An array containing patches to be applied to the sources before
111 # If unset, no custom patches will be applied.
113 # Please note, however, that at some point the eclass may apply
114 # additional distutils patches/quirks independently of this variable.
118 # PATCHES=( "${FILESDIR}"/${P}-make-gentoo-happy.patch )
121 # @ECLASS-VARIABLE: DOCS
124 # An array containing documents installed using dodoc. The files listed
125 # there must exist in the directory from which
126 # distutils-r1_python_install_all() is run (${S} by default).
128 # If unset, the function will instead look up files matching default
129 # filename pattern list (from the Package Manager Specification),
130 # and install those found.
134 # DOCS=( NEWS README )
137 # @ECLASS-VARIABLE: HTML_DOCS
140 # An array containing documents installed using dohtml. The files
141 # and directories listed there must exist in the directory from which
142 # distutils-r1_python_install_all() is run (${S} by default).
144 # If unset, no HTML docs will be installed.
148 # HTML_DOCS=( doc/html/. )
151 # @ECLASS-VARIABLE: EXAMPLES
154 # OBSOLETE: this variable is deprecated and banned in EAPI 6
156 # An array containing examples installed into 'examples' doc
157 # subdirectory. The files and directories listed there must exist
158 # in the directory from which distutils-r1_python_install_all() is run
161 # The 'examples' subdirectory will be marked not to be compressed
164 # If unset, no examples will be installed.
168 # EXAMPLES=( examples/. demos/. )
171 # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD
174 # If set to a non-null value, in-source builds will be enabled.
175 # If unset, the default is to use in-source builds when python_prepare()
176 # is declared, and out-of-source builds otherwise.
178 # If in-source builds are used, the eclass will create a copy of package
179 # sources for each Python implementation in python_prepare_all(),
180 # and work on that copy afterwards.
182 # If out-of-source builds are used, the eclass will instead work
183 # on the sources directly, prepending setup.py arguments with
184 # 'build --build-base ${BUILD_DIR}' to enforce keeping & using built
185 # files in the specific root.
187 # @ECLASS-VARIABLE: DISTUTILS_ALL_SUBPHASE_IMPLS
190 # An array of patterns specifying which implementations can be used
191 # for *_all() sub-phase functions. If undefined, defaults to '*'
192 # (allowing any implementation). If multiple values are specified,
193 # implementations matching any of the patterns will be accepted.
195 # If the restriction needs to apply conditionally to a USE flag,
196 # the variable should be set conditionally as well (e.g. in an early
197 # phase function or other convenient location).
199 # Please remember to add a matching || block to REQUIRED_USE,
200 # to ensure that at least one implementation matching the patterns will
205 # REQUIRED_USE="doc? ( || ( $(python_gen_useflags 'python2*') ) )"
208 # use doc && DISTUTILS_ALL_SUBPHASE_IMPLS=( 'python2*' )
212 # @ECLASS-VARIABLE: mydistutilsargs
215 # An array containing options to be passed to setup.py.
219 # python_configure_all() {
220 # mydistutilsargs=( --enable-my-hidden-option )
224 # @FUNCTION: esetup.py
225 # @USAGE: [<args>...]
227 # Run setup.py using currently selected Python interpreter
228 # (if ${PYTHON} is set; fallback 'python' otherwise).
230 # setup.py will be passed the following, in order:
231 # 1. ${mydistutilsargs[@]}
232 # 2. additional arguments passed to the esetup.py function.
234 # Please note that setup.py will respect defaults (unless overriden
235 # via command-line options) from setup.cfg that is created
236 # in distutils-r1_python_compile and in distutils-r1_python_install.
238 # This command dies on failure.
240 debug-print-function ${FUNCNAME} "${@}"
243 [[ ${EAPI} != [45] ]] && die_args+=( -n )
245 set -- "${PYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
248 "${@}" || die "${die_args[@]}" || return ${?}
251 # @FUNCTION: distutils_install_for_testing
252 # @USAGE: [<args>...]
254 # Install the package into a temporary location for running tests.
255 # Update PYTHONPATH appropriately and set TEST_DIR to the test
256 # installation root. The Python packages will be installed in 'lib'
257 # subdir, and scripts in 'scripts' subdir (like in BUILD_DIR).
259 # Please note that this function should be only used if package uses
260 # namespaces (and therefore proper install needs to be done to enforce
261 # PYTHONPATH) or tests rely on the results of install command.
262 # For most of the packages, tests built in BUILD_DIR are good enough.
263 distutils_install_for_testing() {
264 debug-print-function ${FUNCNAME} "${@}"
267 # 1) because of namespaces, we can't use 'install --root',
268 # 2) 'install --home' is terribly broken on pypy, so we need
269 # to override --install-lib and --install-scripts,
270 # 3) non-root 'install' complains about PYTHONPATH and missing dirs,
271 # so we need to set it properly and mkdir them,
272 # 4) it runs a bunch of commands which write random files to cwd,
273 # in order to avoid that, we add the necessary path overrides
274 # in _distutils-r1_create_setup_cfg.
276 TEST_DIR=${BUILD_DIR}/test
277 local bindir=${TEST_DIR}/scripts
278 local libdir=${TEST_DIR}/lib
279 PYTHONPATH=${libdir}:${PYTHONPATH}
284 --install-lib="${libdir}"
285 --install-scripts="${bindir}"
288 mkdir -p "${libdir}" || die
289 esetup.py "${add_args[@]}" "${@}"
292 # @FUNCTION: _distutils-r1_disable_ez_setup
295 # Stub out ez_setup.py and distribute_setup.py to prevent packages
296 # from trying to download a local copy of setuptools.
297 _distutils-r1_disable_ez_setup() {
298 local stub="def use_setuptools(*args, **kwargs): pass"
299 if [[ -f ez_setup.py ]]; then
300 echo "${stub}" > ez_setup.py || die
302 if [[ -f distribute_setup.py ]]; then
303 echo "${stub}" > distribute_setup.py || die
307 # @FUNCTION: distutils-r1_python_prepare_all
309 # The default python_prepare_all(). It applies the patches from PATCHES
310 # array, then user patches and finally calls python_copy_sources to
311 # create copies of resulting sources for each Python implementation.
313 # At some point in the future, it may also apply eclass-specific
314 # distutils patches and/or quirks.
315 distutils-r1_python_prepare_all() {
316 debug-print-function ${FUNCNAME} "${@}"
318 if [[ ${EAPI} != [45] ]]; then
321 [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
325 # by default, use in-source build if python_prepare() is used
326 if [[ ! ${DISTUTILS_IN_SOURCE_BUILD+1} ]]; then
327 if declare -f python_prepare >/dev/null; then
328 DISTUTILS_IN_SOURCE_BUILD=1
332 _distutils-r1_disable_ez_setup
334 if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
336 # create source copies for each implementation
340 _DISTUTILS_DEFAULT_CALLED=1
343 # @FUNCTION: distutils-r1_python_prepare
345 # The default python_prepare(). A no-op.
346 distutils-r1_python_prepare() {
347 debug-print-function ${FUNCNAME} "${@}"
349 [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
352 # @FUNCTION: distutils-r1_python_configure
354 # The default python_configure(). A no-op.
355 distutils-r1_python_configure() {
356 debug-print-function ${FUNCNAME} "${@}"
358 [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)"
361 # @FUNCTION: _distutils-r1_create_setup_cfg
364 # Create implementation-specific configuration file for distutils,
365 # setting proper build-dir (and install-dir) paths.
366 _distutils-r1_create_setup_cfg() {
367 cat > "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
369 build-base = ${BUILD_DIR}
371 # using a single directory for them helps us export
372 # ${PYTHONPATH} and ebuilds find the sources independently
373 # of whether the package installs extensions or not
375 # note: due to some packages (wxpython) relying on separate
376 # platlib & purelib dirs, we do not set --build-lib (which
377 # can not be overriden with --build-*lib)
378 build-platlib = %(build-base)s/lib
379 build-purelib = %(build-base)s/lib
381 # make the ebuild writer lives easier
382 build-scripts = %(build-base)s/scripts
385 egg-base = ${BUILD_DIR}
387 # this is needed by distutils_install_for_testing since
388 # setuptools like to create .egg files for install --home.
390 dist-dir = ${BUILD_DIR}/dist
393 # we can't refer to ${D} before src_install()
394 if [[ ${EBUILD_PHASE} == install ]]; then
395 cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
397 # installation paths -- allow calling extra install targets
398 # without the default 'install'
405 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
406 cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
407 install-scripts = $(python_get_scriptdir)
413 # @FUNCTION: _distutils-r1_copy_egg_info
416 # Copy egg-info files to the ${BUILD_DIR} (that's going to become
417 # egg-base in esetup.py). This way, we respect whatever's in upstream
419 _distutils-r1_copy_egg_info() {
420 mkdir -p "${BUILD_DIR}" || die
421 # stupid freebsd can't do 'cp -t ${BUILD_DIR} {} +'
422 find -name '*.egg-info' -type d -exec cp -R -p {} "${BUILD_DIR}"/ ';' || die
425 # @FUNCTION: distutils-r1_python_compile
426 # @USAGE: [additional-args...]
428 # The default python_compile(). Runs 'esetup.py build'. Any parameters
429 # passed to this function will be appended to setup.py invocation,
430 # i.e. passed as options to the 'build' command.
432 # This phase also sets up initial setup.cfg with build directories
433 # and copies upstream egg-info files if supplied.
434 distutils-r1_python_compile() {
435 debug-print-function ${FUNCNAME} "${@}"
437 _distutils-r1_create_setup_cfg
438 _distutils-r1_copy_egg_info
440 esetup.py build "${@}"
443 # @FUNCTION: _distutils-r1_wrap_scripts
444 # @USAGE: <path> <bindir>
447 # Moves and wraps all installed scripts/executables as necessary.
448 _distutils-r1_wrap_scripts() {
449 debug-print-function ${FUNCNAME} "${@}"
451 [[ ${#} -eq 2 ]] || die "usage: ${FUNCNAME} <path> <bindir>"
455 local PYTHON_SCRIPTDIR
456 python_export PYTHON_SCRIPTDIR
458 local f python_files=() non_python_files=()
460 if [[ -d ${path}${PYTHON_SCRIPTDIR} ]]; then
461 for f in "${path}${PYTHON_SCRIPTDIR}"/*; do
462 [[ -d ${f} ]] && die "Unexpected directory: ${f}"
463 debug-print "${FUNCNAME}: found executable at ${f#${path}/}"
466 read -r shebang < "${f}"
467 if [[ ${shebang} == '#!'*${EPYTHON}* ]]; then
468 debug-print "${FUNCNAME}: matching shebang: ${shebang}"
469 python_files+=( "${f}" )
471 debug-print "${FUNCNAME}: non-matching shebang: ${shebang}"
472 non_python_files+=( "${f}" )
475 mkdir -p "${path}${bindir}" || die
478 for f in "${python_files[@]}"; do
479 local basename=${f##*/}
481 debug-print "${FUNCNAME}: installing wrapper at ${bindir}/${basename}"
482 _python_ln_rel "${path}${EPREFIX}"/usr/lib/python-exec/python-exec2 \
483 "${path}${bindir}/${basename}" || die
486 for f in "${non_python_files[@]}"; do
487 local basename=${f##*/}
489 debug-print "${FUNCNAME}: moving ${f#${path}/} to ${bindir}/${basename}"
490 mv "${f}" "${path}${bindir}/${basename}" || die
495 # @FUNCTION: distutils-r1_python_install
496 # @USAGE: [additional-args...]
498 # The default python_install(). Runs 'esetup.py install', doing
499 # intermediate root install and handling script wrapping afterwards.
500 # Any parameters passed to this function will be appended
501 # to the setup.py invocation (i.e. as options to the 'install' command).
503 # This phase updates the setup.cfg file with install directories.
504 distutils-r1_python_install() {
505 debug-print-function ${FUNCNAME} "${@}"
507 local args=( "${@}" )
509 # enable compilation for the install phase.
510 local -x PYTHONDONTWRITEBYTECODE=
512 # re-create setup.cfg with install paths
513 _distutils-r1_create_setup_cfg
515 # python likes to compile any module it sees, which triggers sandbox
516 # failures if some packages haven't compiled their modules yet.
517 addpredict "${EPREFIX}/usr/$(get_libdir)/${EPYTHON}"
518 addpredict /usr/lib/portage/pym
519 addpredict /usr/local # bug 498232
521 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
522 # user may override --install-scripts
523 # note: this is poor but distutils argv parsing is dumb
524 local mydistutilsargs=( "${mydistutilsargs[@]}" )
525 local scriptdir=${EPREFIX}/usr/bin
527 # construct a list of mydistutilsargs[0] args[0] args[1]...
529 [[ ${mydistutilsargs[@]} ]] && eval arg_vars+=(
530 'mydistutilsargs['{0..$(( ${#mydistutilsargs[@]} - 1 ))}']'
532 [[ ${args[@]} ]] && eval arg_vars+=(
533 'args['{0..$(( ${#args[@]} - 1 ))}']'
536 set -- "${arg_vars[@]}"
544 scriptdir=${a#--install-scripts=}
549 unset "${arg_var}" "${1}"
556 local root=${D}/_${EPYTHON}
557 [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
559 esetup.py install --root="${root}" "${args[@]}"
561 local forbidden_package_names=( examples test tests )
563 for p in "${forbidden_package_names[@]}"; do
564 if [[ -d ${root}$(python_get_sitedir)/${p} ]]; then
565 die "Package installs '${p}' package which is forbidden and likely a bug in the build system."
568 if [[ -d ${root}/usr/$(get_libdir)/pypy/share ]]; then
570 [[ ${EAPI} == [45] ]] && cmd=eqawarn
571 "${cmd}" "Package installs 'share' in PyPy prefix, see bug #465546."
574 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
575 _distutils-r1_wrap_scripts "${root}" "${scriptdir}"
576 multibuild_merge_root "${root}" "${D}"
580 # @FUNCTION: distutils-r1_python_install_all
582 # The default python_install_all(). It installs the documentation.
583 distutils-r1_python_install_all() {
584 debug-print-function ${FUNCNAME} "${@}"
588 if declare -p EXAMPLES &>/dev/null; then
589 [[ ${EAPI} != [45] ]] && die "EXAMPLES are banned in EAPI ${EAPI}"
591 local INSDESTTREE=/usr/share/doc/${PF}/examples
592 doins -r "${EXAMPLES[@]}"
593 docompress -x "${INSDESTTREE}"
596 _DISTUTILS_DEFAULT_CALLED=1
599 # @FUNCTION: distutils-r1_run_phase
600 # @USAGE: [<argv>...]
603 # Run the given command.
605 # If out-of-source builds are used, the phase function is run in source
606 # directory, with BUILD_DIR pointing at the build directory
607 # and PYTHONPATH having an entry for the module build directory.
609 # If in-source builds are used, the command is executed in the directory
610 # holding the per-implementation copy of sources. BUILD_DIR points
611 # to the 'build' subdirectory.
612 distutils-r1_run_phase() {
613 debug-print-function ${FUNCNAME} "${@}"
615 if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
616 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
617 cd "${BUILD_DIR}" || die
619 local BUILD_DIR=${BUILD_DIR}/build
621 local -x PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
624 # using PYTHONPATH when the ${BUILD_DIR}/lib is not created yet might lead to
625 # problems in setup.py scripts that try to import modules/packages from that path
626 # during the build process (Python at startup evaluates PYTHONPATH, if the dir is
627 # not valid then associates a NullImporter object to ${BUILD_DIR}/lib storing it
628 # in the sys.path_importer_cache)
629 mkdir -p "${BUILD_DIR}/lib" || die
631 # We need separate home for each implementation, for .pydistutils.cfg.
632 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
633 local -x HOME=${HOME}/${EPYTHON}
634 mkdir -p "${HOME}" || die
637 # Set up build environment, bug #513664.
638 local -x AR=${AR} CC=${CC} CPP=${CPP} CXX=${CXX}
639 tc-export AR CC CPP CXX
641 # How to build Python modules in different worlds...
644 # provided by haubi, 2014-07-08
645 *-aix*) ldopts='-shared -Wl,-berok';; # good enough
646 # provided by grobian, 2014-06-22, bug #513664 c7
647 *-darwin*) ldopts='-bundle -undefined dynamic_lookup';;
648 *) ldopts='-shared';;
651 local -x LDSHARED="${CC} ${ldopts}" LDCXXSHARED="${CXX} ${ldopts}"
655 cd "${_DISTUTILS_INITIAL_CWD}" || die
658 # @FUNCTION: _distutils-r1_run_common_phase
659 # @USAGE: [<argv>...]
662 # Run the given command, restoring the state for a most preferred Python
663 # implementation matching DISTUTILS_ALL_SUBPHASE_IMPLS.
665 # If in-source build is used, the command will be run in the copy
666 # of sources made for the selected Python interpreter.
667 _distutils-r1_run_common_phase() {
668 local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
670 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
671 local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" )
672 _distutils_try_impl() {
674 for pattern in "${patterns[@]}"; do
675 if [[ ${EPYTHON} == ${pattern} ]]; then
676 best_impl=${MULTIBUILD_VARIANT}
680 python_foreach_impl _distutils_try_impl
681 unset -f _distutils_try_impl
683 local PYTHON_COMPAT=( "${best_impl}" )
686 _distutils-r1_run_foreach_impl "${@}"
689 # @FUNCTION: _distutils-r1_run_foreach_impl
692 # Run the given phase for each implementation if multiple implementations
693 # are enabled, once otherwise.
694 _distutils-r1_run_foreach_impl() {
695 debug-print-function ${FUNCNAME} "${@}"
697 if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
698 [[ ${EAPI} == [45] ]] || die "DISTUTILS_NO_PARALLEL_BUILD is banned in EAPI ${EAPI}"
700 eqawarn "DISTUTILS_NO_PARALLEL_BUILD is no longer meaningful. Now all builds"
701 eqawarn "are non-parallel. Please remove it from the ebuild."
703 unset DISTUTILS_NO_PARALLEL_BUILD # avoid repeated warnings
706 # store for restoring after distutils-r1_run_phase.
707 local _DISTUTILS_INITIAL_CWD=${PWD}
708 set -- distutils-r1_run_phase "${@}"
710 if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
711 python_foreach_impl "${@}"
713 if [[ ! ${EPYTHON} ]]; then
714 die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
716 local BUILD_DIR=${BUILD_DIR:-${S}}
717 BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
723 distutils-r1_src_prepare() {
724 debug-print-function ${FUNCNAME} "${@}"
726 local _DISTUTILS_DEFAULT_CALLED
728 # common preparations
729 if declare -f python_prepare_all >/dev/null; then
732 distutils-r1_python_prepare_all
735 if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
737 [[ ${EAPI} == [45] ]] && cmd=eqawarn
739 "${cmd}" "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all"
742 if declare -f python_prepare >/dev/null; then
743 _distutils-r1_run_foreach_impl python_prepare
747 distutils-r1_src_configure() {
748 python_export_utf8_locale
750 if declare -f python_configure >/dev/null; then
751 _distutils-r1_run_foreach_impl python_configure
754 if declare -f python_configure_all >/dev/null; then
755 _distutils-r1_run_common_phase python_configure_all
759 distutils-r1_src_compile() {
760 debug-print-function ${FUNCNAME} "${@}"
762 if declare -f python_compile >/dev/null; then
763 _distutils-r1_run_foreach_impl python_compile
765 _distutils-r1_run_foreach_impl distutils-r1_python_compile
768 if declare -f python_compile_all >/dev/null; then
769 _distutils-r1_run_common_phase python_compile_all
774 # Work around for setuptools test behavior (bug 534058).
775 # https://bitbucket.org/pypa/setuptools/issue/292
776 rm -rf "${BUILD_DIR}"/lib/*.egg-info
779 distutils-r1_src_test() {
780 debug-print-function ${FUNCNAME} "${@}"
782 if declare -f python_test >/dev/null; then
783 _distutils-r1_run_foreach_impl python_test
784 _distutils-r1_run_foreach_impl _clean_egg_info
787 if declare -f python_test_all >/dev/null; then
788 _distutils-r1_run_common_phase python_test_all
792 distutils-r1_src_install() {
793 debug-print-function ${FUNCNAME} "${@}"
795 if declare -f python_install >/dev/null; then
796 _distutils-r1_run_foreach_impl python_install
798 _distutils-r1_run_foreach_impl distutils-r1_python_install
801 local _DISTUTILS_DEFAULT_CALLED
803 if declare -f python_install_all >/dev/null; then
804 _distutils-r1_run_common_phase python_install_all
806 _distutils-r1_run_common_phase distutils-r1_python_install_all
809 if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then
811 [[ ${EAPI} == [45] ]] && cmd=eqawarn
813 "${cmd}" "QA: python_install_all() didn't call distutils-r1_python_install_all"
817 # -- distutils.eclass functions --
819 distutils_get_intermediate_installation_image() {
820 die "${FUNCNAME}() is invalid for distutils-r1"
823 distutils_src_unpack() {
824 die "${FUNCNAME}() is invalid for distutils-r1, and you don't want it in EAPI ${EAPI} anyway"
827 distutils_src_prepare() {
828 die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
831 distutils_src_compile() {
832 die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
835 distutils_src_test() {
836 die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
839 distutils_src_install() {
840 die "${FUNCNAME}() is invalid for distutils-r1, you probably want: ${FUNCNAME/_/-r1_}"
843 distutils_pkg_postinst() {
844 die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postinst is unnecessary"
847 distutils_pkg_postrm() {
848 die "${FUNCNAME}() is invalid for distutils-r1, and pkg_postrm is unnecessary"