--- gx86/eclass/distutils-r1.eclass | 52 ++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 13 deletions(-)
diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass index 8dfe6bb..b991ab4 100644 --- a/gx86/eclass/distutils-r1.eclass +++ b/gx86/eclass/distutils-r1.eclass @@ -105,6 +105,38 @@ DEPEND=${PYTHON_DEPS} # HTML_DOCS=( doc/html/ ) # @CODE +# @ECLASS-VARIABLE: myesetuppyargs +# @DEFAULT_UNSET +# @DESCRIPTION: +# An array containing options to be passed to setup.py. +# +# Example: +# @CODE +# python_configure_all() { +# myesetuppyargs=( --enable-my-hidden-option ) +# } +# @CODE + +# @FUNCTION: esetuppy +# @USAGE: [<args>...] +# @DESCRIPTION: +# Run the setup.py using currently selected Python interpreter +# (if ${PYTHON} is set; fallback 'python' otherwise). The setup.py will +# be passed default command-line arguments, then ${myesetuppyargs[@]}, +# then any parameters passed to this command. +# +# This command will die on failure in EAPI 4 and newer, and just return +# the exit code in earlier EAPIs. +esetuppy() { + debug-print-function ${FUNCNAME} "${@}" + + set -- "${PYTHON:-python}" setup.py \ + "${myesetuppyargs[@]}" "${@}" + + echo "${@}" >&2 + "${@}" || die +} + # @FUNCTION: distutils-r1_python_prepare_all # @DESCRIPTION: # The default python_prepare_all(). It applies the patches from PATCHES @@ -147,16 +179,13 @@ distutils-r1_python_configure() { # @FUNCTION: distutils-r1_python_compile # @USAGE: [additional-args...] # @DESCRIPTION: -# The default python_compile(). Runs 'setup.py build' using the correct -# Python implementation. Any parameters passed to this function will be -# passed to setup.py. +# The default python_compile(). Runs 'esetuppy build'. Any parameters +# passed to this function will be passed to setup.py. distutils-r1_python_compile() { debug-print-function ${FUNCNAME} "${@}" cd "${BUILD_DIR}" || die - set -- "${PYTHON}" setup.py build "${@}" - echo "${@}" - "${@}" || die + esetuppy build "${@}" } # @FUNCTION: distutils-r1_python_test @@ -198,10 +227,9 @@ distutils-r1_rename_scripts() { # @FUNCTION: distutils-r1_python_install # @USAGE: [additional-args...] # @DESCRIPTION: -# The default python_install(). Runs 'setup.py install' using -# the correct Python implementation, and appending the optimization -# flags. Then calls distutils-r1_rename_scripts. Any parameters passed -# to this function will be passed to setup.py. +# The default python_install(). Runs 'esetuppy install', appending +# the optimization flags. Then calls distutils-r1_rename_scripts. +# Any parameters passed to this function will be passed to setup.py. distutils-r1_python_install() { debug-print-function ${FUNCNAME} "${@}" @@ -218,9 +246,7 @@ distutils-r1_python_install() { unset PYTHONDONTWRITEBYTECODE cd "${BUILD_DIR}" || die - set -- "${PYTHON}" setup.py install "${flags[@]}" --root="${D}" "${@}" - echo "${@}" - "${@}" || die + esetuppy install "${flags[@]}" --root="${D}" "${@}" distutils-r1_rename_scripts } -- 1.7.12.4