distutils-r1.eclass: Remove support for EAPIs prior to 6

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny
2021-04-09 23:55:50 +02:00
parent df8f9663ac
commit dece0bf6f8
+12 -72
View File
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on the work of: Krzysztof Pawlik <nelchael@gentoo.org>
# @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
@@ -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} )"
@@ -448,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} )"
@@ -480,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 )
@@ -494,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}
@@ -621,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
@@ -648,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:
@@ -941,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
@@ -1081,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
@@ -1094,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