From 40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 28 Apr 2021 20:21:43 +0100 Subject: gentoo resync : 28.04.2021 --- eclass/distutils-r1.eclass | 91 ++++++++-------------------------------------- 1 file changed, 16 insertions(+), 75 deletions(-) (limited to 'eclass/distutils-r1.eclass') diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index 655a33e0d208..2994993e63e8 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -7,7 +7,7 @@ # @AUTHOR: # Author: Michał Górny # Based on the work of: Krzysztof Pawlik -# @SUPPORTED_EAPIS: 5 6 7 +# @SUPPORTED_EAPIS: 6 7 # @BLURB: A simple eclass to build Python packages using distutils. # @DESCRIPTION: # A simple eclass providing functions to build Python packages using @@ -33,8 +33,8 @@ # functions, you should consider calling the defaults (and especially # distutils-r1_python_prepare_all). # -# Please note that distutils-r1 sets RDEPEND and DEPEND unconditionally -# for you. +# Please note that distutils-r1 sets RDEPEND and BDEPEND (or DEPEND +# in earlier EAPIs) unconditionally for you. # # Also, please note that distutils-r1 will always inherit python-r1 # as well. Thus, all the variables defined and documented there are @@ -44,10 +44,10 @@ # https://dev.gentoo.org/~mgorny/python-guide/ case "${EAPI:-0}" in - 0|1|2|3|4) + [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;; - 5|6|7) + [6-7]) ;; *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" @@ -97,8 +97,7 @@ esac if [[ ! ${_DISTUTILS_R1} ]]; then -[[ ${EAPI} == [456] ]] && inherit eutils -[[ ${EAPI} == [56] ]] && inherit xdg-utils +[[ ${EAPI} == 6 ]] && inherit eutils xdg-utils inherit multiprocessing toolchain-funcs if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then @@ -146,7 +145,7 @@ _distutils_set_globals() { fi RDEPEND="${PYTHON_DEPS} ${rdep}" - if [[ ${EAPI} != [56] ]]; then + if [[ ${EAPI} != 6 ]]; then BDEPEND="${PYTHON_DEPS} ${bdep}" else DEPEND="${PYTHON_DEPS} ${bdep}" @@ -202,26 +201,6 @@ unset -f _distutils_set_globals # HTML_DOCS=( doc/html/. ) # @CODE -# @ECLASS-VARIABLE: EXAMPLES -# @DEFAULT_UNSET -# @DESCRIPTION: -# OBSOLETE: this variable is deprecated and banned in EAPI 6 -# -# An array containing examples installed into 'examples' doc -# subdirectory. The files and directories listed there must exist -# in the directory from which distutils-r1_python_install_all() is run -# (${S} by default). -# -# The 'examples' subdirectory will be marked not to be compressed -# automatically. -# -# If unset, no examples will be installed. -# -# Example: -# @CODE -# EXAMPLES=( examples/. demos/. ) -# @CODE - # @ECLASS-VARIABLE: DISTUTILS_IN_SOURCE_BUILD # @DEFAULT_UNSET # @DESCRIPTION: @@ -369,7 +348,7 @@ distutils_enable_sphinx() { python_compile_all() { sphinx_compile_all; } IUSE+=" doc" - if [[ ${EAPI} == [56] ]]; then + if [[ ${EAPI} == 6 ]]; then DEPEND+=" doc? ( ${deps} )" else BDEPEND+=" doc? ( ${deps} )" @@ -426,6 +405,7 @@ distutils_enable_tests() { setup.py) ;; unittest) + test_pkg="dev-python/unittest-or-fail" ;; *) die "${FUNCNAME}: unsupported argument: ${1}" @@ -447,7 +427,7 @@ distutils_enable_tests() { if [[ -n ${test_deps} ]]; then IUSE+=" test" RESTRICT+=" !test? ( test )" - if [[ ${EAPI} == [56] ]]; then + if [[ ${EAPI} == 6 ]]; then DEPEND+=" test? ( ${test_deps} )" else BDEPEND+=" test? ( ${test_deps} )" @@ -479,9 +459,6 @@ esetup.py() { [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context" - local die_args=() - [[ ${EAPI} != [45] ]] && die_args+=( -n ) - [[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg local setup_py=( setup.py ) @@ -493,11 +470,11 @@ esetup.py() { set -- "${EPYTHON}" "${setup_py[@]}" "${mydistutilsargs[@]}" "${@}" echo "${@}" >&2 - "${@}" || die "${die_args[@]}" + "${@}" || die -n local ret=${?} if [[ ${BUILD_DIR} ]]; then - rm "${HOME}"/.pydistutils.cfg || die "${die_args[@]}" + rm "${HOME}"/.pydistutils.cfg || die -n fi return ${ret} @@ -620,12 +597,7 @@ distutils-r1_python_prepare_all() { debug-print-function ${FUNCNAME} "${@}" if [[ ! ${DISTUTILS_OPTIONAL} ]]; then - if [[ ${EAPI} != [45] ]]; then - default - else - [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" - epatch_user - fi + default fi # by default, use in-source build if python_prepare() is used @@ -647,24 +619,6 @@ distutils-r1_python_prepare_all() { _DISTUTILS_DEFAULT_CALLED=1 } -# @FUNCTION: distutils-r1_python_prepare -# @DESCRIPTION: -# The default python_prepare(). A no-op. -distutils-r1_python_prepare() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)" -} - -# @FUNCTION: distutils-r1_python_configure -# @DESCRIPTION: -# The default python_configure(). A no-op. -distutils-r1_python_configure() { - debug-print-function ${FUNCNAME} "${@}" - - [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI 6 (it was a no-op)" -} - # @FUNCTION: _distutils-r1_create_setup_cfg # @INTERNAL # @DESCRIPTION: @@ -830,7 +784,7 @@ distutils-r1_python_test() { nonfatal esetup.py test --verbose ;; unittest) - "${EPYTHON}" -m unittest discover -v + eunittest ;; *) die "Mis-synced test runner between ${FUNCNAME} and distutils_enable_testing" @@ -940,16 +894,6 @@ distutils-r1_python_install_all() { debug-print-function ${FUNCNAME} "${@}" einstalldocs - - if declare -p EXAMPLES &>/dev/null; then - [[ ${EAPI} != [45] ]] && die "EXAMPLES are banned in EAPI ${EAPI}" - - ( - docinto examples - dodoc -r "${EXAMPLES[@]}" - ) - docompress -x "/usr/share/doc/${PF}/examples" - fi } # @FUNCTION: distutils-r1_run_phase @@ -1080,10 +1024,7 @@ distutils-r1_src_prepare() { fi if [[ ! ${_DISTUTILS_DEFAULT_CALLED} ]]; then - local cmd=die - [[ ${EAPI} == [45] ]] && cmd=eqawarn - - "${cmd}" "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all" + die "QA: python_prepare_all() didn't call distutils-r1_python_prepare_all" fi if declare -f python_prepare >/dev/null; then @@ -1093,7 +1034,7 @@ distutils-r1_src_prepare() { distutils-r1_src_configure() { python_export_utf8_locale - [[ ${EAPI} == [56] ]] && xdg_environment_reset # Bug 577704 + [[ ${EAPI} == 6 ]] && xdg_environment_reset # Bug 577704 if declare -f python_configure >/dev/null; then _distutils-r1_run_foreach_impl python_configure -- cgit v1.2.3